Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

participation activity 2.5.2 strings. order the lines of code so that t…

Question

participation activity 2.5.2 strings. order the lines of code so that the program to generate a mad libs style story is valid. ensure any assignments to string variables occur they are output. note: not all of the lines of code may be used. how to use this tool < unused adjective = macho period = day relative = cousin relative = cousin food = input(enter a type of food: ) food = input(enter a type of food: ) main.py print() print(my, relative,says eating, food) print(will make me more, adjective) print(so now i eat them every, period) load default template

Explanation:

Step1: Analyze input - output logic

The program takes user - input for food. It has pre - defined strings for relative, period, and adjective. The goal is to order the code to form a proper "mad libs" style story.

Step2: Rearrange code

The correct order should be to first take the input for food, then use the pre - defined and input values in the print statements to form a story. The correct order of code lines is:

food = input('Enter a type of food: ')
relative = 'cousin'
period = 'day'
adjective ='macho'
print('My', relative,'says eating', food, 'will make me more', adjective)
print('so now I eat them every', period)

Answer:

food = input('Enter a type of food: ')
relative = 'cousin'
period = 'day'
adjective ='macho'
print('My', relative,'says eating', food, 'will make me more', adjective)
print('so now I eat them every', period)