Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
简单Python-3程序中的无效语法错误_Python_Syntax_Python 3.x_Syntax Error - Fatal编程技术网

简单Python-3程序中的无效语法错误

简单Python-3程序中的无效语法错误,python,syntax,python-3.x,syntax-error,Python,Syntax,Python 3.x,Syntax Error,第7行中的问题: 画一个圆圈(乌龟,右): 编译器只告诉我有语法错误,并在 那条线的尽头。 我确信我遗漏了一些简单的东西,但是代码看起来很正确。在python中,我们使用def关键字定义函数。。像 from TurtleWorld import * import math bob = Turtle() print(bob) draw_circle(turtle, r): d = r*2 c = d*math.pi degrees = 360/25 length

第7行中的问题:

画一个圆圈(乌龟,右):

编译器只告诉我有语法错误,并在 那条线的尽头。
我确信我遗漏了一些简单的东西,但是代码看起来很正确。

在python中,我们使用
def
关键字定义函数。。像

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()

在python中,我们使用
def
关键字定义函数。。像

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()
你需要写:

def draw_circle(turtle, r):
    # ...
到。

您需要写:

def draw_circle(turtle, r):
    # ...
到。

您缺少def部件吗?


您缺少def部分吗?

我想,如果其他三个答案不够明显,我应该告诉您首先需要def

def draw_circle(turtle, r):
@复制人:
说真的,我们能再得到一个答案吗?我相信3(如果你加上我,4)是不够的

我想,万一其他三个答案不够明显,我应该告诉你,你首先需要def

def draw_circle(turtle, r):
@复制人: 说真的,我们能再得到一个答案吗?我认为3(如果你加上我,4)是不够的