Simpel Python计算器-语法错误-缩进错误

Simpel Python计算器-语法错误-缩进错误,python,Python,我最近开始学习Python。我以前从未编写过代码,但这似乎是一个挑战。我做的第一件东西是这个计算器。然而,我似乎无法让它发挥作用 while True: print("Typ 'plus' to add two numbers") print("Typ 'min' to subtract two numbers") print("Typ 'multiplication' multiply two numbers") print("Typ 'division' to

我最近开始学习Python。我以前从未编写过代码,但这似乎是一个挑战。我做的第一件东西是这个计算器。然而,我似乎无法让它发挥作用

while True:
    print("Typ 'plus' to add two numbers")
    print("Typ 'min' to subtract two numbers")
    print("Typ 'multiplication' multiply two numbers")
    print("Typ 'division' to divide two numbers")
    print("Typ 'end' to abort the program")
    user_input = input(": ")

    if user_input == "end"
        break

    elif user_input == "plus":          
        num1 = float(input("Give a number: "))                  
        num2 = float(input("Give another number: "))
        result = str(num1 + num2)                                   
        print("The anwser is: " + str(result))

    elif user_input == "min":
        num1 = float(input("Give a number: "))                  
        num2 = float(input("Give another number: "))            
        result = str(num1 - num2)                                   
        print("The anwser is: " + str(result))

    elif user_input == "maal":
        num1 = float(input("Give a number:"))                   
        num2 = float(input("Give another number: "))            
        result = str(num1 * num2)                                   
        print("The anwser is: " + str(result))

    elif user_input == "deel":
        num1 = float(input("Give a number: "))                  
        num2 = float(input("Give another number: "))            
        result = str(num1 + num2)                                   
        print("The anwser is: " + str(result))

    else:
        print ("I don't understand!")

我知道这很可能是愚蠢的事情,我仍然在学习。我只是想学一门新技能,而不是打扰我那些知道如何编码的朋友

this-if语句后缺少冒号

if user_input == "end"
    break
应该是:

if user_input == "end":
    break

如果你不告诉我们问题是什么,我们就帮不了你。它说这是无效的语法:如果用户输入==“end”break,我也希望你的缩进在源代码中不是那样的…太好了,谢谢!然而,现在它在同一行上给了我一个错误,在循环外说:“break”。我已尝试从代码中删除这两行。然后,我被要求输入我想执行的计算,但当我输入“加”、“分”、“除”或“乘”时,它会不断重复“输入”。缩进是语法的一个重要部分,而你的语法就差了。请再次阅读本教程的第一部分。