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):
编译器仅告诉我语法错误,并在命令行高亮显示冒号。
该行的结尾。
我确定我缺少一些简单的东西,但是代码对我来说似乎正确。
最佳答案
在python中,我们使用def
关键字定义函数。
def draw_circle(turtle, r):
# ...
关于python - 简单的Python-3程序中的无效语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3471165/