Created
April 3, 2020 02:22
-
-
Save roman-on/a0c719b9a5a07208da9ff1d36f87bafc to your computer and use it in GitHub Desktop.
Convert Celsius to Fahrenheit and vise versa
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 50F 50f = 10C 10c | |
| temp = str(input("Insert the temperature you would like to convert:")) | |
| a = int(temp[:-1]) # num | |
| b = temp[-1:] # c / C | |
| c = int(temp[:-1]) # num | |
| d = temp[-1:] # f / F | |
| ce = ((5*c-160)//9) | |
| fe = ((9*a+(32*5))//5) | |
| if (b == "C") or (b == "c"): | |
| print(fe, "F") | |
| elif (d == "F") or (d == "f"): | |
| print(ce, "C") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment