“修复Python if语句中的打印语法错误”

时间:2019-05-23 02:25:57

标签: python syntax

做一个小项目-简单的餐厅菜单订购代码。有顶部的工作。为什么Python会给我这个简单的print语句一个语法错误?

manager_func = input("Would you like to close the store for the day? Enter Y or N")
    if manager_func == "Y":
        continueOrder == False
        perc = input("What percentage of the daily takings is profit? Enter number from 1 to 99")
        final_total = (sum(day_totals) * (perc / 100)
        print('Here are the totals for each order', day_totals)
        print('And the corresponding order codes', day_orders)
        print('The total profit with a % taking of', perc, 'is', final_total)
    else:
        continueOrder == True

第6行,它给我打印语法错误

1 个答案:

答案 0 :(得分:0)

在第5行上,您有3个右括号,但只有2个右括号:

final_total = (sum(day_totals) * (perc / 100)

应该是

final_total = (sum(day_totals) * (perc / 100))

编辑:

此外,第3行并未达到您的期望。由于您使用的是==,因此您正在检查是否相等,而不是分配值。

econtinueOrder == False

应该是

continueOrder = False

还有第10行:

continueOrder == True

应该是

continueOrder = True