Teaching cPython and Web Development in the Browser
Teaching Python in the Browser

Teaching Python in the Browser


The Forest Wiki has excellent support for teaching Python in the Browser.


There are 2 big advantages to teaching Python in the Browser. 

  1. You do not have to install on everyone's computers
  2. You can monitor the work remotely.  
    1. Even in the class room, stay 2 meters away. 

the problem is that Python is not native to the browser.  There are multiple solutions.

  1. Skulpt.  Good Interactivity.  Easy.
  2. Pyodide. Real Python, but no debugging, and no network access. 
  3. Transcrypt.  Not quite Python, but best of both worlds. 

 

Skulpt

We focus on turtle graphics, that is the most fun, and has the best  user experience. The teacher sets the assignments, the students do them.   Even when the student is working from home, the teacher can monitor progress. If there is an issue, or during grading,  the teacher can privately comment on that student's work.    When the time is right, the teacher can check a box to publish the answers.  When the time is up, the teacher can check another box to limit new submissions. 

The students move through a series of steps.

  1. Simple Lines and Polygons
  2. Colored Shapes
  3. Spirographs
  4. Mazes
  5. Turtle Races

Skulpt is Python running in the Browser.  It is written in Javascript. 

import turtle

t = turtle.Turtle()

for c in ['red', 'green', 'yellow', 'blue']:
    t.color(c)
    t.forward(75)
    t.left(90)

 

 

t.right(90)
t.left(90)
t.forward(100)
t.backward(100)

t.circle(60)
t.dot(30)
t.goto(x,y)
t.home()
 

t.pencolor("green")
 t.fillcolor("red")
 t.bgcolor("blue")