简体   繁体   English

为什么`if`在Python Turtle中不起作用,在我看来我写的一切都是正确的

[英]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.

相关问题 为什么 python 不打印我写入的所有内容? - Why doesn't python print everything I wrote into it? Python程序未写入输出csv,其他所有内容似乎均正常运行 - Python program doesn't write to output csv, everything else seems to work correctly 为什么即使我写正确,argparse也不起作用并发送无效的选项错误消息? - Why doesn't argparse work and send invalid option error message even if i wrote correctly? 我在 python 上写了一个简单的代码,但它没有按预期工作,有人可以帮助我吗 - I wrote a simple code on python, but it doesn't work as intended can someone help me 为什么这个猴子补丁不适用于 python 乌龟? - Why doesn't this monkey patch work for python turtle? 为什么导入对我不起作用? - Python - Why doesn't import work for me? - Python python,乌龟,“onkeypress”不起作用 - python, turtle, “onkeypress” doesn't work 乌龟的定义对我来说不错,但不起作用 - turtle definition looks ok to me but doesn't work 为什么在另一个函数中重新定义一个函数不起作用? (巨蟒龟) - Why doesn’t redefining a function inside another function work? (Python Turtle) 通过“不在”列表进行Python Turtle碰撞检测。 为什么不起作用? - Python Turtle Collision Detection via “not in” list. Why doesn't it work?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM