Найти - Пользователи
Полная версия: Помогите разобраться с кодом
Начало » Центр помощи » Помогите разобраться с кодом
1
Manich
Добрый день! Учу Python, не понимаю, почему выдает данную ошибку

File “downloads/calc.py”, line 14

    zfloat(input(“Enter a number:”))

    ^

SyntaxError: invalid syntax

Соответственно не могу пойти дальше. Пробовал менять переменную-не помогло. Операционка Mac OS. Вот код:

while True:
    print("Options")
    print("Enter 'add' to add two numbers")
    print("Enter 'subtract' to subtract two numbers")
    print("Enter 'multiply' to multiply two numbers")
    print("Enter 'divide' to divide two numbers")
    print("Enter 'quit' to end the program")
    user_input=input(":")
     if user_input=="quit":
        break
    elif user_input== "add":
        x=(float(input("Enter a number:"))
        z=(float(input("Enter a number:"))
        result=str(x+z)
        print ("The ansever is" +result)
    else:
        print("Unknown input")



За ранее спасибо за помощь!
PEHDOM
после “x=” и “z=” скобки лишние
FishHook
там где if user_input==“quit” лишний отступ вначале
Manich
Спасибо большое, очень помогли!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB