Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CoderDojoTC/python
Browse files Browse the repository at this point in the history
  • Loading branch information
dmccreary committed Apr 15, 2023
2 parents 47ebaf0 + 2273305 commit b15539c
Show file tree
Hide file tree
Showing 34 changed files with 495 additions and 453 deletions.
29 changes: 27 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,34 @@ on:
pull_request:
branches: [master]

env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

permissions:
contents: 'write'
id-token: 'write'
pull-requests: 'write'
jobs:
build:
name: Build and Deploy Documentation
runs-on: ubuntu-latest

steps:
- name: Checkout Branch
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false

- name: Checkout Master
uses: actions/checkout@v2
uses: actions/checkout@v3

if: github.event_name == 'push'
with:
fetch-depth: 0
persist-credentials: false

- name: Set up Python 3.7
uses: actions/setup-python@v2
Expand All @@ -25,7 +46,11 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install mkdocs-material
- name: Check
run: |
pwd
ls -la
- name: Deploy
run: |
git pull
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": [
"Mojhave",
"Trinkit",
"coderdojo",
"jupyter",
Expand Down
Binary file added docs/img/night_sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/rocketpanda.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/row-of-circles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/img/stop-sign.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# CoderDojo Twin Cities Python Resources
This GitHub repository is for sharing teaching resources to teach Python. This includes hints on getting your Python environments setup up and extensive lesson plans for serveral enviornments.
This GitHub repository is for sharing teaching resources to teach Python. This includes hints on getting your Python environments setup up and extensive lesson plans for several environments.


Our mentors have used several different envornments for teaching Python. They each have pros and cons. What our mentors like is getting new students started using a graphical programming environment such as turtle graphics libraries. Here are some of our favorite tools:
Our mentors have used several different environments for teaching Python. They each have pros and cons. What our mentors like is getting new students started using a graphical programming environment such as turtle graphics libraries. Here are some of our favorite tools:

- [**Trinket.io**](http://trinket.io) is an easy-to use, kid friendly web-based turtle graphics for beginners.
- [**Jupyter Notebooks**](https://jupyter.org/) also have some support for turtle graphics. Jupyter Notebooks can be tricky to setup for the first time, but they are the perfect on-ramp for teaching data literacy.
- [**Raspberry Pi**](https://www.raspberrypi.org/documentation/usage/python/) - The Raspberry Pi foundation has selected Python as its primary tool for teaching programming. If you have a Raspberry Pi there are many resources for you. Trinket and Jupyter Notebooks will also run on many Raspberry Pi devices.
- **Robots** Our students love robots. Python is also the preferred language in many robotics courses. Today we teach beginning robotics with Scratch and Arduino, but we continue to investigate systems like Raspberry Pi robots that can be programmed with Python. Let us know if you have any low-cost kid friendly ideas. We have tested the JetBot and other robots and we continue to look for solutions.

Now lets briefly go into the pros and cons of these systems.
Now let's briefly go into the pros and cons of these systems.

## Learning Python with Trinket

We use the [trinket.io](http://trinket.io) web site to teach our introduction to python. Trinket has a nice turtle graphics library which is ideal for fast visual feedback. Because it is a free and a pure web web based environment it meets the criteria for our courses. There is no complex setup and each student can continue to do development when they are at home. The downside of Trinket is it has limited functionality, only supports Python 2.X in the free version and you must have an internet connection to use Trinket. If you need Python 3.X web
We use the [trinket.io](http://trinket.io) web site to teach our introduction to python. Trinket has a nice turtle graphics library which is ideal for fast visual feedback. Because it is a free and a pure web-based environment it meets the criteria for our courses. There is no complex setup and each student can continue to do development when they are at home. The downside of Trinket is it has limited functionality, only supports Python 2.X in the free version and you must have an internet connection to use Trinket. If you need Python 3.X web
version you can use the free [repl.id](https://repl.it/) web site.

## Learning Python with Jupyter Notebooks
You can also use Jupyter Notebooks to draw turtle graphics. The notebook will open a new window to draw your turtle graphis. Getting Jupyter Notebooks is a bit tricky to setup on many PCs. However, once it is setup it offers tens of thousands of sample programs to learn python coding. Jupyter Notebooks are also the preferred tool by many data science professionals.
You can also use Jupyter Notebooks to draw turtle graphics. The notebook will open a new window to draw your turtle graphics. Getting Jupyter Notebooks is a bit tricky to setup on many PCs. However, once it is setup it offers tens of thousands of sample programs to learn python coding. Jupyter Notebooks are also the preferred tool by many data science professionals.
An example of a Jupyter Notebook that uses turtle graphs is [here](jupyter/draw-figure.ipynb)

## Learning Python with Raspberry Pi
If you have a Rasperry Pi there are many great ways to learn Python. One of first things is to try out one of the Python development environments for the Raspberry Pi.
If you have a Raspberry Pi there are many great ways to learn Python. One of first things is to try out one of the Python development environments for the Raspberry Pi.

## Learning Python with Robots
Right now we are continuing to try to find the right combination of easy-of-use and low-cost robots to teach python. If you hear of any good tools, please let us know.
Right now, we are continuing to try to find the right combination of easy-of-use and low-cost robots to teach python. If you hear of any good tools, please let us know.

## Target Audience
Learning Python is ideal for students that have good keyboarding skills. If students have difficulty with doing functions like copy and pasting text we suggest they start with a block-programming language like Scratch.

## List of Concepts
Here are some of the concepts we will be learning in this course. If you are already familiar with these concepts you can skip over some of the labs.

- **importing libraries** We need to tell Pyhton what functions we want to use. We will use the import function to tell Python which functions we need to use in our programs.
- **importing libraries** We need to tell Python what functions we want to use. We will use the import function to tell Python which functions we need to use in our programs.
- **drawing** Turtle graphs has a set of drawing functions. We will learn to use these to draw patterns on the screen.
- **square walk** - teach your turtle to walk in a square and draw figures.
- **variables** Variables make our programs easier to read and easier to understand.
Expand All @@ -41,7 +41,7 @@ Here are some of the concepts we will be learning in this course. If you are al
- **functions** Functions allow us to break large programs into chunks that we can give names and can call over and over.
- **function parameters** Functions can also take parameters to change the behavior of a function.
- **random numbers** Random number functions allow our programs to have the computer select new random number between a range of numbers.
- **lists** Lists alow us to create collections of names.
- **lists** Lists allow us to create collections of names.
- **inputs** Inputs allow us to prompt the user for values.
- **recursion** Recursion allows us to have programs call themselves to create repeating patterns.
- **modules** Once you have a group of related functions you can put them all together into a module. This makes it easier for others to reuse your programs.
Expand Down
10 changes: 8 additions & 2 deletions docs/intermediate/20-installing-local-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
The next few labs are labs that must be run on your local computer because the will interact with the local operating system and local file system. You will not be able to use Trinket to run these programs.

The main site for Python is here:

[https://www.python.org/](https://www.python.org/)
[https://www.python.org/](https://www.python.org/)

If you go to that site there will be pages for Downloads and Documentation for each version of your desktop or PC.

Expand Down Expand Up @@ -44,6 +43,13 @@ for step in range(0, len(myPath)):
print(step+1, myPath[step])
```

## Using Conda Environments
We use conda to keep all our Python projects separate.

```sh
conda create -n coderdojo python=3
conda activate coderdojo
```

## Installing Python in an Integrated Development Environment (IDE)

Expand Down
122 changes: 0 additions & 122 deletions docs/intermediate/21-files.md

This file was deleted.

11 changes: 0 additions & 11 deletions docs/intermediate/22-images.md

This file was deleted.

16 changes: 10 additions & 6 deletions docs/trinket/00-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ The map above is a visual guide to our Introduction to Python course. Students
For students that are new to programming, here are some sample programs (what we call learning labs) that you can try. You can learn by reading the sample programs, going to the Trinkit.io site and changing some values in the code. Each of the labs has experiments at the end you can do to extend to see if you have mastered the concepts before you go on to the next lab.

1. [Trinket Account](./01a-trinket-account.md) - introduction to the Turtle Graphs library with a list of drawing functions
1. [Turtle graphics](./01a-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions
2. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times
2. [Turtle graphics](./01b-turtle-graphics.md) - introduction to the Turtle Graphs library with a list of drawing functions
3. [Simple square](./02-simple-square.md) - draw a square by moving and turning right four times
4. [Variables](./03-variables.md) - add variables for the move edge distance and angle
5. [Loops](./04-loops.md) - add a loop to make our code smaller
6. [Conditionals](./05-conditionals.md) - add an if statement to change the color
7. [Functions](./06-functions.md) - create a shape function
8. [Function parameters](./07-function-parameters.md) - add parameters to our function
9. [Random](./08-random.md) - generate random numbers that are used do drive the turtle
9. [Lists](./08-list.md) - store a list of colors
10. [Inputs](./11-input.md) - get some input from the user
11. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree

10. [Lists](./08-list.md) - store a list of colors
11. [Inputs](./11-input.md) - get some input from the user
12. [Recursion](./12-recursion.md) - create a function that calls itself to draw a tree
13. [Shapes](./13-shape-module.md) - creating a separate module to draw shapes
14. [Color picker](./14-color-picker.md) - picking different colors
15. [Sine wave](./15-sine-wave.md) - creating a sine wave
16. [Changing Background](./16-changing-background.md) - changing background image and capturing keyboard
17. [Controlling MouseClicks](./17-controlling-mouseclicks.md) - Tracking mouse clicks

6 changes: 3 additions & 3 deletions docs/trinket/02-simple-square.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ Here is a link to the Trinket web site with this program running:
[https://trinket.io/python/564899ffe9](https://trinket.io/python/564899ffe9)
You can click on this link and then press the Run button. You should see the python code on the left side and the drawing on the right side of your screen.

## Explaination
## Explanation
The first three lines will be the same for all our programs. They import the turtle library into our program, create a new turtle object and then assign the turtle a shape icon. Although almost all the turtle libraries work this way, there are some minor differences you will see in future examples.

## Reorinenting your turtle
Note that at the start, the turtle is facing to the right. After the last instruction, it is also facing to the right. This is a common best practice so that the turtle gets reoriented after some drawing function. If you remove the last right(90) function and run the program again you will see the turtle ends up facing upward. But if you rerun the progam you will still get the same square because the orientation of the turtle is not stored between runs.
## Reorienting your turtle
Note that at the start, the turtle is facing to the right. After the last instruction, it is also facing to the right. This is a common best practice so that the turtle gets reoriented after some drawing function. If you remove the last right(90) function and run the program again you will see the turtle ends up facing upward. But if you rerun the program you will still get the same square because the orientation of the turtle is not stored between runs.

## Experiments
Can you change the distance and angle the turtle moves? What happens when you change the numbers for the forward and right functions? Can you go left as well as right?
Expand Down
Loading

0 comments on commit b15539c

Please sign in to comment.