Example #1
0
def convert_temp():
    option = int(input("Enter a menu option: "))
    temp = Temp()
    if option == 1:
        f = int(input("Enter degrees Fahrenheit: "))
        temp.setFahrenheit(f)
        print("Degrees Celsius:", temp.getCelsius())    
    elif option == 2:
        c = int(input("Enter degrees Celsius: "))
        temp.setCelsius(c)
        print("Degrees Fahrenheit:", temp.getFahrenheit())
    else:
        print("You must enter a valid menu number.")
Example #2
0
def convert_temp():
    temp = Temp()
    option = int(input("Enter a menu option: "))
    if option == 1:
        f = int(input("Enter degrees Fahrenheit: "))
        c = temp.setFahrenheit(f)
        c = temp.getCelsius(f)
        # c = temp.to_celsius(f)
        # c = round(c, 2)
        print("Degrees Celsius:", c)
    elif option == 2:
        c = int(input("Enter degrees Celsius: "))
        f = temp.setCelsius(c)
        f = temp.getFahrenheit(c)
        # f = temp.to_fahrenheit(c)
        # f = round(f, 2)
        print("Degrees Fahrenheit:", f)
    else:
        print("You must enter a valid menu number.")