[英]I Keep Getting "IndentationError: expected an indented block"
My program is simple, i'm planing on making a console application where you can draw some art using turtle by some commands such as "left_star","left_circle" ext.我的程序很简单,我打算制作一个控制台应用程序,您可以在其中通过一些命令(例如“left_star”、“left_circle”ext)使用乌龟绘制一些艺术作品。 When I tried to implement updates, it gives me the indentation error for some reason.Can you help me with this problem?
当我尝试实现更新时,由于某种原因它给了我缩进错误。你能帮我解决这个问题吗?
import turtle
import random
turtle.color('green', 'red')
turtle.begin_fill()
print(" ")
print("right_star: makes a right star. ")
print(" ")
print("left_star: makes a star on the left. ")
print(" ")
print("right_circle: makes a circle on the right. ")
print(" ")
print("left_circle: makes a circle on the left side")
print(" ")
_input = input("What shape do you want to make? type 'help' if you want help: ")
turtle.Turtle()
print(turtle.pos())
if _input == "left_star":
i = 0
while i != 10:
turtle.forward(200)
turtle.left(200)
i += 1
if i > 9:
#_input2 = input("What shape do you want to make? type 'help' if you want help: ")
elif _input=="right_circle":
while True:
turtle.forward(70)
turtle.right(70)
_input2 = input("What shape do you want to make? type 'help' if you want help: ")
else _input == "right_star":
while True:
turtle.right(200)
turtle.forward(200)
while True:
_input2 = input("What shape do you want to make? type 'help' if you want help: ")
elif _input == "left_circle":
while True:
turtle.left(70)
turtle.forward(70)
elif _input == "help":
print("right_star: makes a right star. ")
print("left_star: makes a star on the left. ")
print("right_circle: makes a circle on the right. ")
print("left_circle: makes a circle on the left side")
print("PLEASE RESTART THE APPLICATION!'python opt.py'")
Your elif _input=="right_circle":
and all consecutive elif
s are not aligned with if _input == "left_star":
.你的
elif _input=="right_circle":
和所有连续的elif
都没有与if _input == "left_star":
对齐。 Remove the unnecessary spaces in front of the elif
s.删除
elif
前面不必要的空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.