import math
amplitude = 100
for x in range(540):
# math.sin returns the sine value of a particular value
# 1) Try changing math.sin to math.cos or math.tan
y = amplitude*math.sin(math.radians(x-math.pi/2))
point = codesters.Point(x-250, y, 1, "black")
#_____________________
# these lines create the grid lines and the labels
for label in range(500):
if label == 0:
bot_label = codesters.Text("0", label-240, -230)
bot_label.set_size(.7)
elif label % 90 == 0:
bot_line = codesters.Line(label-250, -220, label-250, 250, "gray")
bot_label = codesters.Text(str(label), label-260, -230)
bot_label.set_size(.7)
side_line = codesters.Line(-220, label-250, 250, label-250, "gray")
bot_label = codesters.Text(str(label), -245, label-240)
bot_label.set_size(.7)
-
Run Code
-
-
Stop Running Code
-
Show Chart
-
Show Console
-
Codesters How To (opens in a new tab)