我在测试时得到这个错误:
Please enter the customer's name: 1
Please enter the customer's Phone Number:01506890639
Please enter the size of group: 4
Please enter the rating of the meal: 3
Do you wish to continue: Y/N?n
The largest group that visited had a cohort of:4
Traceback (most recent call last):
File "E:/CWtsk/code2.1.py", line 93, in <module>
main()
File "E:/CWtsk/code2.1.py", line 12, in main
mealrating(score)
File "E:/CWtsk/code2.1.py", line 67, in mealrating
mp = mp + 1
UnboundLocalError: local variable 'mp' referenced before assignment
我不确定引用的内容,因为正如您在我的代码中看到的,它以前没有被引用过。在
^{pr2}$我不知道这是什么。虽然我需要调整最后一个功能,因为我忘记了它的故障排除。在
您还没有定义mp,但已经在赋值的右侧使用了它。这将引发错误。通过以下方式轻松解决:
相关问题 更多 >
编程相关推荐