The program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient is corresponds to the ingredients mentioned above.
<h3>Further explanation</h3>
Python is a general-purpose programming language. We want to write a python program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient.
48 cookies = 1.5 cups of sugar + 1 cup of butter + 2.75 cups of flour, so:
def main():
cookies = float(input("How many cookies would you like to make?\n>"))
sugar = (1.5 * cookies) / 48.0
butter = cookies / 48
flour = (2.75 * cookies) / 48
print("To make ", cookies, " cookies, you will need:\n", \
format(sugar, '.2f'), " cups of sugar\n", \
format(butter, '.2f'), " cups of butter\n", \
format(flour, '.2f'), " cups of flour", sep='')
redoQuery()
def redoQuery():
yn = input("Would you like to check another batch size? (y/n)\n>")
if yn == 'y':
main()
elif yn =='n':
exit()
else:
print("Please enter only a lowercase \'y\' or lowercase \'n\'," \
"then press enter")
redoQuery()
main()
The run program is shown in the attachment below.
<h3>Learn more</h3>
1. Learn more about python https://brainly.in/question/8049240
<h3>Answer details</h3>
Grade: 9
Subject: Computers and Technology
Chapter: programming with python
Keywords: python