In [2]:
def main():
#1. Asks if you want to convert the temp from Fahrenheit to Celsius, or Celsius to Fahrenheit.
forC = input("Press f for Farenheit to Celsius or c for Celsius to Farenheit ==>")

#2. Accepts as input the temperature you enter
if forC == "f":
temperature = int(input("Whats the temperature? ==>"))
#3. Converts it to your choice
actualTemp = (temperature - 32) * (5/9) #to celsius
print("the temperature in celsius is", actualTemp)
#5. Asks if you want to go again.
again = input("Wanna convert another temperature? Type yes or no ==>")
if again == "yes":
main()
elif again == "no":
print("have a good day!")
else:
print("errr... dont know what you said, but we'll just restart the program anyways!")
main()
#2. Accepts as input the temperature you enter
elif forC == "c":
temperature = int(input("Whats the temperature? ==>"))
#3. Converts it to your choice
actualTemp = (temperature * 9/5) + 32 #to farenheit
print("the temperature in farenheit is", actualTemp)
#5. Asks if you want to go again.
again = input("Wanna convert another temperature? Type yes or no ==>")
if again == "yes":
main()
elif again == "no":
print("have a good day!")
else:
print("errr... dont know what you said, but we'll just restart the program anyways!")
main()
#Will restart the program if you type something else
else:
print("only press f or c please")
del forC
main()

main()


Press f for Farenheit to Celsius or c for Celsius to Farenheit ==>c
Whats the temperature? ==>40
the temperature in farenheit is 104.0
Wanna convert another temperature? Type yes or no ==>yes
Press f for Farenheit to Celsius or c for Celsius to Farenheit ==>f
Whats the temperature? ==>78
the temperature in celsius is 25.555555555555557
Wanna convert another temperature? Type yes or no ==>no
have a good day!