找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 2914|回复: 2

[求助] 超新手画海龟图遇到困难

1

主题

2

帖子

2

积分

贫民

积分
2
yuyuanjiabing47 发表于 2020-4-16 15:25:16 | 显示全部楼层 |阅读模式


跟着书籍学习的时候,画海龟图,例子如图所示

然后照葫芦画瓢的时候,出现错误提示了(附件),请问是缩进的问题吗。。。?
python的缩进有什么窍门呢

求大神们指点!谢谢!!


#Spiralmyname.py-prints a colorful spiral of the uers's name

import turtle                  #set up turtle graphics
t=turtle.Pen()
turtle.bgcolor("black")
colors=["red","yellow","blue","green"]

#Ask the user's name using turtle's textinput pop-up window
your_name=turtle.textinput("Enter your name","What is your name?")

#Draw a spiral of the name on the screen,written 100 times
for x in range(100):
    t.pencolor(colors[x%4])    #Rotate through the four colors
    t.penup()                  #Don't draw the regular spiral lines
    t.forward(x*4)             #Just move the turtle on the screen
    t.pendown()                #Write the user's name,bigger each time
    t.write(your_name,font=("Arial",int((x+4)/4),"bold")
            t.left(92)         #Turn left,just as in our other spirals


错误提示

错误提示
原代码.png
回复

使用道具 举报

1

主题

2

帖子

2

积分

贫民

积分
2
yuyuanjiabing47  楼主| 发表于 2020-4-16 17:51:17 | 显示全部楼层
哦豁,自己找到问题了……
回复 支持 反对

使用道具 举报

2

主题

6

帖子

6

积分

贫民

积分
6
金三皮 发表于 2020-4-17 11:18:39 | 显示全部楼层
yuyuanjiabing47 发表于 2020-4-16 17:51
哦豁,自己找到问题了……

什么问题?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表