Hey everyone, I need help to figure out how to input while loop in here.
I have this program where it converts from Fahrenheit to Celsius or Celsius to Fahrenheit.
The purpose is to convert this program so that it repeats the calculation as long as the user wants.
After the user input and the calculation, I have to make the program ask the user if they want to repeat.
If the response is yes, the program will take the input again and perform the calculation. Keep doing it
as long as it's yes. Mainly I have to input a while loop for this to convert the program.
I am not sure how to start and where to put the while loop... I might have the idea but I'm not sure
how to translate it.
import math op = int(input("Please enter 1: for converting Fahrenheit -> Celsius , 2: for converting Celsius -> Fahrenheit")) num = int(input("Please enter the temperature")) if op == 1: convert = 5/9 * (num - 32) print("The temperature in Celsius is" , convert) elif op == 2: convert = 9/5 *num + 32 print ("The temperature in Fahrenheit is" , convert) else: print("Invalid operation : enter 1 or 2")