简单Python-3程序中的语法错误
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(turtle, r):
编译器只告诉我有语法错误,并把那行末尾的冒号标红了。
我知道我可能漏掉了什么简单的东西,但我觉得代码看起来没问题。
4 个回答
1
1
2
在Python中,我们用def
这个关键词来定义函数。就像这样:
def draw_circle(turtle, r):
# ...