函数

1+

import turtle

def f(a):
    return 2 * a

def ff(a):
    return a * a /100

turtle.penup()

w = turtle.window_width()
h = turtle.window_height()

left = -w/2,0
right = w/2,0
top = 0,h/2
bottom = 0,-h/2

turtle.goto(left)
turtle.pendown()
turtle.goto(right)
turtle.penup()
turtle.goto(top)
turtle.pendown()
turtle.goto(bottom)
turtle.penup()
turtle.speed(0)

for x in range(-200,201):
    turtle.goto(x,f(x))
    turtle.dot()

for x in range(-200,201):
    turtle.goto(x,ff(x))
    turtle.dot()

1+

发表评论