In: Other
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.
Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit 0.
# in python
#code
def main():
#reading a line of text and splitting by white space to create a list of two tokens
fields=input().split(' ')
#looping until the first word is 'quit' in any case
while fields[0].lower()!='quit':
#displaying in the format 'Eating a day keeps the doctor away.'
#assuming that there will always be 2 values in input string separated by space
print('Eating {} {} a day keeps the doctor away.'.format(fields[1],fields[0]))
# reading next line of text and splitting by white space
fields = input().split(' ')
#invoking main() method
main()
#output (user input in green text)
