Alright, so I was working on a simple temperature conversion program but am stuck on an error message I keep getting. Whenever I try to run the program, the F in the line, F = (C * 9/5 + 32), gets highlighted and a window pops up that states "invalid syntax". I have no idea what the issue could be so i'm hoping it's something simple one of you can point out for me. Thanks in advance!

#Menu Interface
def menu():
    print("1. C to F")
    print("2. F to C")
    print("3. Quit")

# C to F
def CtoF():
    C = float(input("Temperature in Celsius:")
    F = (C * 9/5 + 32)
    print (F,"degrees Fahrenheit")
# F to C
def FtoC()
    F = float(input("Temperature in Fahrenheit:")
    C = (F-32) * 5/9
    print (C,"degrees Celsius")
    def option():
        loop = 1
        while loop == 1:
            o = input("Choose an option:")
            if o = 1:
                CtoF()
            elif o = 2:
                FtoC()
            elif o = 3:
                loop = 0
option()
有帮助吗?

解决方案

You're missing an end parenthesis on your line

     C = float(input("Temperature in Celsius:")
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top