2010-08-12 118 views
0
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):

编译器只告诉我会出现语法错误,并在该行的末尾突出显示冒号 。 我确定我错过了一些简单的东西,但代码看起来很适合我。

回答

2

在Python中,我们定义使用def关键字功能..喜欢

def draw_circle(turtle, r): 
    # ... 
+0

Ahhhhhhh ....我知道这是明显的东西。我感觉很傻......谢谢。 – 2010-08-12 19:28:52

0

我想,万一其他三个答案还不够明显,我要告诉你,你需要先高清

def draw_circle(turtle, r): 

@people复制: 严重的是,我们可以得到更多1个回答?我相信3(4,如果你加我)是不够的