from TurtleWorld import *
import math
bob = Turtle()
print(bob)
draw_circle(turtle, r):
d = r*2
c = d*math.pi
degrees = 360/25
length = c // 25
for i in range(25):
fd(turtle, length)
rt(turtle, degrees)
draw_circle(bob, 25)
wait_for_user()第7行的问题是:
Draw_circle(海龟,r):
编译器只告诉我有语法错误,并高亮显示该行末尾的冒号。我肯定我漏掉了一些简单的东西,但代码在我看来是对的。
发布于 2010-08-12 19:16:43
在python中,我们使用def关键字定义函数。喜欢
def draw_circle(turtle, r):
# ...发布于 2010-08-12 19:17:41
你需要写:
def draw_circle(turtle, r):敬定义函数。
发布于 2010-08-12 19:18:03
http://docs.python.org/release/3.0.1/tutorial/controlflow.html#defining-functions
你错过了德福那部分?
https://stackoverflow.com/questions/3471165
复制相似问题