#(°C × 9/5) + 32 = °F or in plain English, Multiple by 9, then divide by 5, then add 32. #(°F - 32) x 5/9 = °C or in plain English, First subtract 32, then multiply by 5, then divide by 9. #Variables: cel(Celsius) far(Fahrenheit) repeat="true" while repeat=="true": print("Please choose an option:-") print("1. Celsius to Fahrenheit") print("2. Fahrenheit to Celcius") option=input("Please Choose Now:") if option == "1": print("Celcius to Fahrenheit") print("Please enter in a value.") value=input() value2=int(value)*9 value3=int(value2)/5 answer=int(value3)+32 print(value+ " Celcius is equal to " + str(answer) + " Fahrenheit") print("Do you wish to convert again?") option2=input("Y or N") if option2 == "Y": repeat=="true" elif option2 == "N": print("Have a nice day!") repeat="false" exit() else option2 != elif option == "2": print("Fahrenheit to Celcius") print("Please enter in a value.") value=input() value2=int(value)-32 value3=int(value2)*5 answer=int(value3)/9 print(value + " Fahrenheit is equal to " + str(answer) + " celcius") print("Do you wish to convert again?") option2=input("Y or N") if option2 == "Y": repeat=="true" elif option2 == "N": print("Have a nice day!") repeat="false" exit() else: print("Error must be 1 or 2")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question