|
跟着书籍学习的时候,画海龟图,例子如图所示
然后照葫芦画瓢的时候,出现错误提示了(附件),请问是缩进的问题吗。。。?
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
|
-
错误提示
-
|