Skip to content

Commit b49ddea

Browse files
committed
Added shape function to REPL labs
1 parent 4cb27e2 commit b49ddea

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

docs/repl/08-shape-function.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Repl Shape Function
2+
3+
```py
4+
import turtle
5+
t = turtle.Turtle()
6+
colorList = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'pink', 'brown', 'gray', 'gold']
7+
8+
9+
def shape(color, x, y, dist, edges):
10+
t.penup()
11+
t.goto(x,y)
12+
t.pendown()
13+
t.color(color)
14+
t.begin_fill()
15+
angle = 360 / edges
16+
for i in range(edges):
17+
t.fd(dist)
18+
t.rt(angle)
19+
t.end_fill()
20+
21+
22+
shape('red', -100, 100, 50, 4)
23+
shape('green', 50, 50, 50, 6)
24+
shape('blue', 50, -50, 40, 8)
25+
```

docs/trinket/01a-trinket-account.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Setting up a Trinket Account
1+
# Getting Starts With Trinket
22

33
These labs assume that you have internet access and a modern web browser such as Chrome.
44

@@ -10,4 +10,5 @@ We use the [Trinket web site](https://trinket.io/) because it a kid-save place t
1010
1. You can rename programs
1111
1. You can create folders of programs
1212
1. You can run your program
13-
1. You can make the program fill the screen (fullscreen)
13+
1. You can make the program fill the screen (fullscreen)
14+
1. Download your Python code

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ nav:
33
- CoderDojo TC: https://coderdojotc.github.io/CoderDojoTC/
44
- Beginning Python - Trinket:
55
- Introduction: trinket/00-introduction.md
6-
- Trinket Account: trinket/01a-trinket-account.md
6+
- Using Trinket: trinket/01a-trinket-account.md
77
- Turtle Graphics: trinket/01b-turtle-graphics.md
88
- Turtle Square: trinket/02-simple-square.md
99
- Variables: trinket/03-variables.md
@@ -20,6 +20,7 @@ nav:
2020
- Beginning Python - Repl.it:
2121
- Square: repl/02-square.md
2222
- Flower: repl/07-flower.md
23+
- Shape Function: repl/08-shape-function.md
2324
- Recursion: repl/12-recursion.md
2425
- Intermediate Python:
2526
- Introduction: intermediate/intro.md

0 commit comments

Comments
 (0)