Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Enter temperature in Farenheit
- try:
- InputTempF= float(input("Enter a temperature in Farenheit: "))
- except ValueError:
- print("That wasn't a float!")
- #Converts user-input Fahrenheit to Celsius.
- InitF = InputTempF #This add-on to the global function allows for user input.
- def return_celsius(): #This is a global function to return Celsius.
- print((InitF - 32)/1.8)
- return_celsius()
- #Change 0C to F:
- InitC = 0
- #Global function to convert Celsius to Farenheit.
- def return_farenheit():
- print((InitC*1.8)+32)
- return_farenheit()
- #Change 100C to F:
- InitC = 100
- return_farenheit()
- #Change 40F to C:
- InitF = 40
- return_celsius()
- #Change 80F to C:
- InitF = 80
- return_celsius()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement