---
toc:
maxLevel=1
---
> Dear Heavenly Father,
As we gather here today to embark on a new journey of learning, we invite Your presence into this classroom.
Bless each student with wisdom, understanding, and a thirst for knowledge. Let Your light shine upon us, illuminating the path of learning, so we may contemplate your beauty and love in everything you made.
May this classroom be a place of respect, fellowship, and growth. Help us to be open to new ideas, to embrace challenges, and to support one another in our academic endeavors. Bless this class so that it may be a space where minds are enriched, friendships are formed, and hearts are touched.
Guide our imaginations and desires towards your love and justice, so that we may respond adequately to your call to be Christ’s agents of renewal in the world.
Through our Lord Jesus Christ, your Son, who lives and reigns with you in the unity of the Holy Spirit, one God, for ever and ever.
Amen.
# Presentations
Stand up and sit when someone says what you would say:
- 1st round: major
- 2nd round: favorite sport
- 3rd round: favorite board game
## Our relationship
Heidelberg Catechism Q&A 107: When god forbids envy, hatred, and anger, he commands us to love our neighbor as ourselves; to show patience, peace, meekness, mercy, and all kindness, towards him, and prevent his hurt as much as in us lies' and that we do good, even to our enemies.
- How can I make this course lovely to you?
- Sometimes, it is even not lovely to me...
- Together we can make it!
- Let's make "a community of people who love knowledge"
- Not easy! We need God.
- Get to know each other more. Change seats whenever you can!
# Syllabus
| | | |
|:---------------------:|:---------------------------:|:--------------:|
| Quizzes | Websites I need to register | Study sessions |
| Software we are using | Office hours | ChatGPT |
| Readings | Diversity and inclusion | Schedule |
# Programs
- Programming = writing programs. What are programs?



## Programs are forms of wisdom
> "The Lord brought me forth as the first of his works, before his deeds of old; I was formed long ages ago, at the very beginning, when the world came to be. When there were no watery depths, I was given birth, when there were no springs overflowing with water; before the mountains were settled in place, before the hills, I was given birth, before he made the world or its fields or any of the dust of the earth. I was there when he set the heavens in place, when he marked out the horizon on the face of the deep, when he established the clouds above and fixed securely the fountains of the deep, when he gave the sea its boundary so the waters would not overstep his command, and when he marked out the foundations of the earth. 30 Then I was constantly at his side. I was filled with delight day after day, rejoicing always in his presence, rejoicing in his whole world and delighting in mankind. Proverbs 8.22-31


# Drawing with programs
Open this [Python Sandbox](https://pythonsandbox.com/turtle) website. Let's write some programs using Python.
Starting code:
```python
import turtle
t = turtle.Turtle()
t.speed(5) # 1:slowest, 3:slow, 5:normal, 10:fast, 0:fastest
```
This simple Python code that uses the `turtle` library for drawing shapes and graphics.
**Explanation:**
1. **`import turtle`**:
- This line imports the `turtle` module, which allows you to control a turtle-like drawing cursor that moves around the screen and draws as it moves.
- `turtle` is built into Python, so you don't need to install anything extra to use it.
2. **`t = turtle.Turtle()`**:
- This creates a new turtle object called `t`. Think of this as your turtle character or cursor that will move around and draw on the screen.
- Now, `t` can be used to give commands to the turtle, such as moving it forward, turning it, or changing its drawing speed.
3. **`t.speed(5)`**:
- This sets the turtle’s drawing speed. The number passed to `speed()` can range from 0 (the fastest) to 10 (fast).
- In this case, the speed is set to `5`, meaning the turtle will move at a normal speed.
## What you can do:
- [Check complete documentation here](https://docs.python.org/3/library/turtle.html)
### 1. **`t.forward(distance)` and `t.backward(distance)`**
- **`forward(distance)`**: Moves the turtle forward by the specified `distance` in pixels.
- **`backward(distance)`**: Moves the turtle backward by the specified `distance` in pixels.
### 2. **`t.right(angle)` and `t.left(angle)`**
- **`right(angle)`**: Rotates the turtle to the **right** (clockwise) by the specified `angle` in degrees.
- **`left(angle)`**: Rotates the turtle to the **left** (counterclockwise) by the specified `angle` in degrees.
### 3. **`t.penup()` and `t.pendown()`**
- **`penup()`** tells the turtle to stop drawing as it moves.
- **`pendown()`** tells the turtle to start drawing again after moving.
- Example:
```python
t.penup()
t.forward(50) # Moves forward without drawing
t.pendown()
t.forward(50) # Moves forward and draws a line
```
### 4. **`t.setpos(x, y)` or `t.goto(x, y)`**
- This moves the turtle to a specific position (`x`, `y`) on the screen. The turtle moves in a straight line.
### 5. **`t.circle(radius)`**
- This command draws a circle with the given radius.
### 6. **`t.color("color_name")`**
- This sets the pen color (the color of the line the turtle draws).
### 7. **`t.begin_fill()` and `t.end_fill()`**
- These commands are used to fill shapes with color. You start with `begin_fill()` before drawing a shape and end with `end_fill()` after completing it.
- Example:
```python
t.color("red")
t.begin_fill()
t.circle(50)
t.end_fill()
```
- This draws a red circle and fills it with the color red.
## Let's practice!
- Try to draw some of these forms or any one you like:
- A red square
- A house
- A smiley face
# Adding loops
Observe the following code:
```python
import turtle
t = turtle.Turtle()
# Start drawing a square
for i in range(4):
t.forward(100) # Move forward 100 pixels
t.left(90) # Turn right 90 degrees
t.circle(100)
```
- What do you think that `for i in range(4):` is doing?
- What is the difference between code that is *indented* (i.e., with some spacing) and code that is not?
# Adding functions
Observe the following code:
```python
import turtle
t = turtle.Turtle()
def draw_square(pen, size):
for i in range(4):
pen.forward(size) # Move forward the number of pixels specified in "size"
pen.left(90) # Turn right 90 degrees
draw_square(t, 100)
t.left(90)
draw_square(t, 50)
```
- It seems we are defining a command called `draw_square`. What does it do?
- Can you define a new command call `draw_triangle`?
# Adding multiple turtles
```python
import turtle
raphael = turtle.Turtle()
raphael.color("red")
raphael.shape("turtle")
donatello = turtle.Turtle()
donatello.color("purple")
donatello.shape("turtle")
leonardo = turtle.Turtle()
leonardo.color("blue")
leonardo.shape("turtle")
michelangelo = turtle.Turtle()
michelangelo.color("orange")
michelangelo.shape("turtle")
def draw_square(pen, size):
for i in range(4):
pen.forward(size)
pen.left(90)
draw_square(raphael, 50)
donatello.left(90)
draw_square(donatello, 50)
leonardo.left(180)
draw_square(leonardo, 50)
michelangelo.left(270)
draw_square(michelangelo, 50)
```
- What is this code doing?