When you make taffy (a pliable candy), you must heat the candy mixture to 270 degrees Fahrenheit. Write a program that will help a cook make taffy. The cook should be able to enter the temperature reading from their thermometer into the program. The program should continue to let the cook enter temperatures until the temperature is at least 270 degrees. When the mixture reaches or exceeds 270 degrees, the program should stop asking for the temperature and print Your taffy is ready for the next step!. However, if the temperature ever reaches above 330 degrees, print You burned the taffy!

Respuesta :

Answer:

The solution code is written in Python 3.

  1. temp = int(input("Enter current temperature (Fahrenheit): "))
  2. while(temp < 270):
  3.    temp = int(input("Enter current temperature (Fahrenheit): "))
  4.    
  5. if(temp > 330):
  6.    print("You burned the taffy!")
  7. else:
  8.    print("Your taffy is ready for the next step")

Explanation:

Firstly, we can try to get a first temperature reading (Line 1)

if the first reading is smaller than 270, keep prompting user for the next reading using while loop (Line 3 - 4)

if the input temperature is bigger or equal to 270, the program will exist the while loop and proceed to check if the final temperature reading is bigger than 330 to determine an appropriate message to display (Line 6 - 9).