Question: In python 3 using this as a starrting point: ANIMALS = ('fly.', 'spider,', 'bird.', 'cat.', 'dog.', 'goat.', 'cow.', 'horse.') LINES = ('I don't know why

In python 3

using this as a starrting point:

ANIMALS = ('fly.', 'spider,', 'bird.', 'cat.', 'dog.', 'goat.', 'cow.', 'horse.') LINES = ('I don\'t know why she swallowed the fly.', 'That wriggled and jiggled and tickled inside her.', 'How absurd to swallow a bird.', 'Imagine that to swallow a cat.', 'My, what a hog, to swallow a dog.', 'She just opened her throat and in walked the goat.', 'I don\'t know how she swallowed a cow.', 'She\'s dead, of course.') def title(): pass def verse(n): pass 

and this

import old_lady # the driver function def main(): # print out the title old_lady.title() # print out the verses for num in range(len(old_lady.ANIMALS)): old_lady.verse(num) # run the program main() 

Minimizing the number of if statements in the verse. The minimum is two. and not using helper functions and produce the following output:

I Know an Old Lady

I know an old lady who swallowed a fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a bird. How absurd to swallow a bird. She swallowed the bird to catch the spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a cat. Imagine that to swallow a cat. She swallowed the cat to catch the bird. She swallowed the bird to catch the spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a dog. My, what a hog, to swallow a dog. She swallowed the dog to catch the cat. She swallowed the cat to catch the bird. She swallowed the bird to catch the spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a goat. She just opened her throat and in walked the goat. She swallowed the goat to catch the dog. She swallowed the dog to catch the cat. She swallowed the cat to catch the bird. She swallowed the bird to catch the spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

I know an old lady who swallowed a cow. I don't know how she swallowed a cow. She swallowed the cow to catch the goat. She swallowed the goat to catch the dog. She swallowed the dog to catch the cat. She swallowed the cat to catch the bird. She swallowed the bird to catch the spider, That wriggled and jiggled and tickled inside her. She swallowed the spider to catch the fly. I don't know why she swallowed the fly. Perhaps she'll die.

There was an old lady who swallowed a horse. She's dead, of course.

example like:

import old_lady # the driver function def main(): # print out the title old_lady.title() # print out three verses old_lady.verse(1) old_lady.verse(3) old_lady.verse(0) # run the program main() 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!