0
我想繪製在Python中使用海龜的正弦波,但我有一個問題,我用goto語句的while循環來繪製波,但在轉換中的y值是不變的(儘管它們確實發生了變化,但只是不在goto中)爲什麼會這樣呢?因爲X的表現也海龜和正弦python
import math
import turtle
wn = turtle.Screen()f
wn.bgcolor('lightblue')
fred = turtle.Turtle()
x = 0
while x < 360:
y = math.sin(math.radians(x))
print y
fred.goto(x, y)
x += 1
wn.exitonclick()
你確定它不僅僅是太平坦看不到嗎? 「sin」從-1變爲1,而你的x座標需要更大範圍的值。 – user2357112 2015-04-06 00:08:24
謝謝!正是這一點,當我乘以一百,我可以看到一切 – pokemonfan 2015-04-06 00:16:41