89.4k views
1 vote
Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways. Complete the program to read the needed values from input, that the existing output statement(s) can use to output a short story. Ex: If the input is: Eric Chipotle 12 cars

2 Answers

5 votes

Answer:

Playing around with this and came up with this, it took about an hour before I understood what it was wanting.

first_name = input()

generic_location=input()

whole_number= input()

plural_noun= input()

print(first_name, 'went to', generic_location, 'to buy', whole_number, 'different types of', plural_noun)

Step-by-step explanation:

I didnt understand it at first until I thought about it. This would be the answer if you are looking for it.

User Alv
by
5.0k points
4 votes

Answer:

statement = input("Enter four words separated by a space: ")

split_list = statement.split(" ")

print(f"{split_list[0]} went to {split_list[1]} to buy {split_list[2]} different types of {split_list[3]}")

Step-by-step explanation:

The python program uses the input function to get user input from the STDIN and the words gotten are splitted to a list, then the items of the list are used as part of a sentence.

User Tim Wijma
by
4.9k points