首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我一直收到"IndentationError:期望一个缩进的块“

我一直收到"IndentationError:期望一个缩进的块“
EN

Stack Overflow用户
提问于 2020-10-15 05:56:37
回答 1查看 80关注 0票数 0

我的程序很简单,我打算做一个控制台应用程序,在那里你可以通过"left_star","left_circle“ext等命令使用海龟绘制一些艺术作品。当我试图实现更新时,它给了我一些reason.Can的缩进错误,你能帮我解决这个问题吗?

代码语言:javascript
复制
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'")
EN

回答 1

Stack Overflow用户

发布于 2020-10-15 06:02:19

您的elif _input=="right_circle":和所有连续的elif未与if _input == "left_star":对齐。删除elif前面不必要的空格。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64362056

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档