[英]Why am I getting “IndentationError: expected an indented block” here?
[英]I Keep Getting "IndentationError: expected an indented block"
我的程序很簡單,我打算制作一個控制台應用程序,您可以在其中通過一些命令(例如“left_star”、“left_circle”ext)使用烏龜繪制一些藝術作品。 當我嘗試實現更新時,由於某種原因它給了我縮進錯誤。你能幫我解決這個問題嗎?
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'")
你的elif _input=="right_circle":
和所有連續的elif
都沒有與if _input == "left_star":
對齊。 刪除elif
前面不必要的空格。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.