Skip to main content
 首页 » 编程设计

python之需要帮助来解决语法错误消息

2025年05月04日14cloudgamer

else Moves=='x': 
              t.up() 
              t.goto(220,200) 
              t.down() 
              t.setheading(45) 
              t.fd(length) 
              t.bk(length) 
              t.fd(length/2) 
              t.setheading(135) 
              t.fd(length/2) 
              t.bk(length) 
              t.up() 
              t.fd(length/2) 

当我运行该程序时,它显示语法错误并且移动以红色突出显示

请您参考如下方法:

不确定你的条件流程是什么样的,但看起来应该是 elif 而不是 else

elif Moves=='x': 

表达式跟在 if 和 elif 语句之后。