Add python code for lab
This commit is contained in:
parent
2491b50434
commit
335808fb57
1 changed files with 31 additions and 0 deletions
31
thinkcspy/Chapter-5-Exercises/Python-files/Lab.py
Normal file
31
thinkcspy/Chapter-5-Exercises/Python-files/Lab.py
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# Runestone.Academy thinkcspy course
|
||||||
|
# Chapter 5
|
||||||
|
# Lab
|
||||||
|
|
||||||
|
import math
|
||||||
|
import turtle
|
||||||
|
|
||||||
|
wn = turtle.Screen()
|
||||||
|
wn.bgcolor('lightblue')
|
||||||
|
|
||||||
|
turtle.setworldcoordinates(0, -1.25, 360, 1.25)
|
||||||
|
|
||||||
|
fred = turtle.Turtle()
|
||||||
|
fred.speed(10)
|
||||||
|
fred.color('red')
|
||||||
|
|
||||||
|
george = turtle.Turtle()
|
||||||
|
george.speed(10)
|
||||||
|
george.color('blue')
|
||||||
|
|
||||||
|
for angle in range(361):
|
||||||
|
x = angle
|
||||||
|
y = math.sin(math.radians(angle))
|
||||||
|
fred.goto(x,y)
|
||||||
|
|
||||||
|
for angle in range(361):
|
||||||
|
x = angle
|
||||||
|
y = math.cos(math.radians(angle))
|
||||||
|
george.goto(x,y)
|
||||||
|
|
||||||
|
wn.exitonclick()
|
||||||
Loading…
Reference in a new issue