为了账号安全,请及时绑定邮箱和手机立即绑定

变量说它没有定义,但它是

变量说它没有定义,但它是

慕田峪7331174 2022-06-28 16:46:13
错误信息:Traceback (most recent call last):  File "C:/Users/ADMIN/Desktop/python/footballcomplex.py", line 85, in <module>    if input2 == 'a':NameError: name 'input2' is not defined这是第 83-85 行:input2 = input("Would you like to long pass to 3(a) or through ball to 2(b)")if input2 == 'a':如果您想立即阅读全文:link to codehttps://pastebin.com/bhYMKa8M问题在于当我将 b 或 c 用于第一个 a、b 和 c 问题时。但 A 工作得非常好。请帮助我真的不知道。Python 3.7 版
查看完整描述

2 回答

?
牧羊人nacy

TA贡献1862条经验 获得超7个赞

删除之前的缩进line83



查看完整回答
反对 回复 2022-06-28
?
萧十郎

TA贡献1815条经验 获得超13个赞

83号线,

input2 = input("Would you like to long pass to 3(a) or through ball to 2(b)")

在它之前的 if 语句中。

if input1 == 'a':

现在它只在 input1=='a' 时要求输入,但是如果你去掉那个缩进,它会要求输入而不管 input1


查看完整回答
反对 回复 2022-06-28
  • 2 回答
  • 0 关注
  • 121 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号