
Patrick B. answered 02/17/21
Math and computer tutor/teacher
def ToCelsius(fTemp):
return (float(fTemp)-32)*5.0/9
def ToFahrenheit(cTemp):
return (float(cTemp)*9.0)/5 + 32
def menu():
x=-1
print(" (1) Converts Fahrenheit to Celsius ")
print(" (2) Converts Celsius to Fahrenheit ")
x = input(" Please input your selection :>")
return x
###########################################
x = menu()
if (int(x)==1):
F = input("Please input the Fahrenheit Temperature :>")
C = ToCelsius(F)
print(" Converted Fahrenheit Temperature " + str(F) + " to " + str(C) + " Celsius")
elif (int(x)==2):
C = input("Please input the Celsius Temperature :>")
F = ToFahrenheit(C)
print(" Converted Celsius Temperature " + str(C) + " to " + str(F) + " Fahrenheit")
else:
print("invalid selection")