Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You may not use any list functions other than len(), pop(), extend() and append(). List slices ARE allowed using the [:] operator if you want.

You may not use any list functions other than len(), pop(), extend() and append().

List slices ARE allowed using the [:] operator if you want.

Your younger cousin keeps asking for the same stories told over and over again. Youve decided to automate the storytelling with a Python program. Your function tell_story should take in a list of strings in story, and then print the story from the list according to the direction variable:

forwards: tell the story in the order its presented in the list

backwards: tell the story backwards

every other: tell your cousin only every other line in the story.

Your function should choose an ending to the story depending on the input ending type:

happy: and they all lived happily ever after.

sad: but alas, it did not last.

Anything else: and thats all Im going to say about that. The story should be printed to the terminal according to the instructions in ending and direction. The ending of a story always

comes at the end, no matter what the direction of the story is.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago