repl.it
@mcparadip/

Graphing Calculator

Python (with Turtle)

No description

fork
loading
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import turtle, math

zoom = 8

t = turtle.Turtle()
t.speed(10)

# 262 x 280

# Draw X Axis

t.up()
t.setpos(-262, 0)
t.down()
t.forward(524)

# Draw Y Axis

t.up()
t.setpos(0, -280)
t.down()
t.left(90)
t.forward(560)


# Graph

t.pencolor("red")

t.up()

for i in range(-262, 263, zoom):
    t.setpos(i, math.sin(i/zoom)*zoom)
    t.dot(zoom)

# Draw X Numbers

t.setpos(-262, 8)
t.write(-262/zoom)

t.setpos(242, 8)
t.write(262/zoom)

# Draw Y Numbers

t.setpos(8, -272)
t.write(-280/zoom)

t.setpos(8, 268)
t.write(280/zoom)







result
console
?