[英]Why doesn't `if` work in Python Turtle , it seems to me I wrote everything correctly
import turtle
turtle.color ("black", "red")
turtle. speed (10)
while True:
a = input("введите действие (вперед-w, назад-s, влево-a, направо-d):"))
if a == "w":
u = int(input("насколько?:"))
turtle.forward (u)
enter image description here在此处输入图像描述
if
does not work in Python turtle, please help if
在 Python 龟中不起作用,请帮忙
Почему в Python turtle не работает "IF"? Почему в Python 乌龟 не работает "IF"?
The initial problem is this line:最初的问题是这一行:
а = input("..."))
You have one too many closing parentheses.你有一个太多的右括号。 Try not to confuse the parentheses inside the quotes and the ones outside.
尽量不要混淆引号内的括号和引号外的括号。 Running your code should have produced an error:
运行您的代码应该会产生错误:
SyntaxError: unmatched ')'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.