Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started