예제 #1
0
def main():  # Define main function.
    fahrenheit = float(input("Enter the temperature in degrees Fahrenheit: "))
    cel_convert = temps.fahr_to_celsius(fahrenheit)  # Execute fahr_to_celsius function in temps module and pass fahrenheit value. Then assigne return to cel_convert variable.
    print("In Celsius, that's ", format(cel_convert, '.2f'), " degrees.", sep='')  #

    celsius = float(input("Enter the temperature in degrees Celsius: "))
    fahr_convert = temps.celsius_to_fahr(celsius)  # Execute celsius_to_fahr function in temps module and pass celsius value. Then assign the return to fahr_convert variable.
    print("In Fahrenheit, that's ", format(fahr_convert, '.2f'), " degrees.", sep='')
def main():
	f = float(input('Enter a degree fahrenheit: '))
	# Display the temperature in degrees celsius.
	print('In degrees celsius the temperature is')
	print(format(temps.fahr_to_celsius(f), '.2f'))

	c = input('Enter a degree celsius:')
	# Display the temperature in degrees fahrenheit.
	print('In degrees fahrenheit the temperature is')
	print(format(temps.celsius_to_fahr(c), '.2f'))