A cookie recipe calls for the following ingredients:
1.5 cups of sugar
1 cup of butter
2.75 cups of flour
The recipe produces 48 cookies with this amount of the ingredients. Write a python program that asks the user how many cookies he or she wants to make, and then displays the number of cups of each ingredient needed for the specified number of cookies

Respuesta :

Python is frequently used for creating websites and applications, automating repetitive tasks, and analyzing and displaying data.

What is Python program used for?

  • Python is frequently used for creating websites and applications, automating repetitive tasks, and analyzing and displaying data. Python has been used by many non-programmers, including accountants and scientists, for a variety of routine activities like managing finances since it's very simple to learn.

#This gets the number of cookies

cookies = float(input("Number of cookies: "))

#This calculates the amount of sugar

sugar = (1.5 * cookies) / 48.0

#This calculates the amount of butter

butter = cookies / 48

#This calculates the amount of flour

flour = (2.75 * cookies) / 48

#This prints the amount of sugar, butter and flour needed

print("You need ", format(sugar, '.2f'), " cups of sugar, ", format(butter, '.2f'), " cups of butter and ", format(flour, '.2f'), " cups of flour", sep='')

To learn more about Python   refer,

https://brainly.com/question/12867701

#SPJ4

ACCESS MORE