Hello,

Ok so this is a fun assignment, but I just can't figure it out.

My Python program should ask the user for a series of words, then fill in the proper places in the story using the user’s answers. We will use the [...] notation for placeholders. For example, if you see [a noun], then you will ask the user to enter a noun. When showing theresults of the puzzle, the user’s input will be in uppercase letters.
Consider the following sentence: I got him a [gift:a noun]. Not a [an adjective] [gift]
or a loud one or even a [an adjective] [gift] that runs around chasing its [a body
part] and drooling on the [a noun]. Notice, the placeholder [gift:a noun]. Here you
will ask the user to enter a noun. But, then that response will be used every time you see [gift] in the story.

This is what the output needs to look like:

'''Enter a filename : gift -giving - ver2 . madlib
Please enter a family member : David
Please enter an event : Wing Bowl Contest
Please enter a number : 2801
Please enter a noun : toilet
Please enter an adjective : spicy
Please enter a body part : feet
Please enter a noun : deer
Please enter a proper noun : Washington DC
Please enter a plural noun : bananas
Please enter a proper name : Jupiter

Here ’s the completed story .

For my DAVID ’s WING BOWL CONTEST present about 2801 years ago ,
I got him a TOILET . Not a SPICY TOILET or a loud one or
even a SPICY TOILET that runs around chasing its FEET
and drooling on the DEER . I got them a WASHINGTON DC , bred in China
thousands of years ago to be the BANANAS of the royal family . We
named it JUPITER .'''

Thanks!

Good luck, we help you out if you post enough effort. Add one function at time. I would start from parsing the text and recognizing the tags and tag uses. Split or partition methods would be helpfull. of course you could use also use re module, which would probably make program even simpler.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.