repl.it
@jeffrobot/

CP02_DayOne

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
59
60
61
62
63
64
65
66
import turtle

#create a new turtle object named bob
bob = turtle.Turtle()
#set bob's speed to 1 (out of 10)
bob.speed(0)
#set bob's shape to Turtle
bob.shape("turtle")

def SimpleTurtle():
  #make Bob walk forward 100 units
  bob.forward(100) 

def ZigZag():
  #make bob turn right 45 degrees
  bob.right(45)
  #make Bob walk forward 50 units
  bob.forward(50)
  #make Bob turn left 90 degrees
  bob.left(90)
  #make Bob walk forward 50 units
  bob.forward(50)

  #1. Modify this function so that bob walks in a diamond

def FourSided():
  length = 10
  bob.forward(length)
  bob.left(90)
  bob.forward(length)
  bob.left(90)
  bob.forward(length)
  bob.left(90)
  bob.forward(length)

  #2. Modify this function so that the length of each side is 100 units

def Circle():
  #Repeat the indented code block ten times
  for i in range(10):
    bob.forward(50)
    bob.left(30)

  #3. Modify this function so that Bob completes his circle

def Kiss():
  sally = turtle.Turtle()
  sally.shape("turtle")
  sally.color("purple")
  sally.setposition(100,0)
  sally.left(180)
  sally.forward(25)

  #4. Modify this function so that Bob and Sally meet in the middle for a Kiss
  #5. Modify this function so that four turtles meet in the middle for a big kiss.


window = turtle.Screen()
window.bgcolor("white")


#SimpleTurtle()
ZigZag()
#FourSided()
#Circle()
#Kiss()
result
console