Teaching with the Python Visual Sandbox

Michael Weigend 17.7.2004 - 16.11.2005



Each workshop is unique. The content depends on the audience's knowledge and special interest.


We need a computer lab with internet connectivity and data projector.

The programming language Python needs not to be installed. (But it is a great language, easy to learn und totally free.)

The participants can work either alone or in pairs.

The participants should have some general knowledge about computer programming. They need not to know anything about Python (but it would be nice).
Only little computer language syntax knowledge is necessary for most of the PVS-exercises. This can be learned extremely fast during the workshop. (In fact it is a nice experience how useful and independent from language syntax general programming competency is.)

General Structure of a workshop

Short introduction to the idea of the PVS and the topic and structure of the workshop (5 min).

The participants register at the PVS (5 min).

Before starting a block of hands-on exercises there is a discussion about relevant aspects of Python syntax (2 to 10 min)

Before using a PVS-application for the first time there is a short introduction to its proper usage (2 min)

A single Python Visual exercise takes 3 to 5 minutes. Usually the students do a block of two or three Python Visuals. They analyze short programs and judge different visualizations (animations) that are supposed to explain how these programs work.
After these hands-on exercises the coach presents an evaluation of the participants' answers (automatically generated by the PVS). There is a discussion about the advantages and problems of intuitions used in the the different visualisations.

It takes 5 to 20 minutes to do a Python Quiz (average is 10 min). The player analyzes a small Python script by assigning appropriate animated models to each program statements. Some of the presented animations are definitively wrong. So the player has to be careful. She or he can earn points for correct judgement. Wrong decisions lead to "penality points". After the quiz there is a short discussion about the appropriateness of intuitions. This is an opportunity to detect misconceptions.

Python Puzzle is some kind of visual program editor. The player manipulates pieces of Python code with the mouse and "builds" a function definition for a given task. The puzzle function can be tested. If it returns the expected result, the player is rewarded by points. The algorithm to be implemented is visualized by animations. The time for a Python Puzzle game is limited (10 to 15 min). So the players experience some time pressure.

Doing the exercises the students earn ponts. They can always check, how many points they have already got.

At the end of the workshop the person who has got the most points receives an award.


In general a PVS-workshop is about intuition in computer programming. Depending on the audience's interest and knowledge we focus on different topics.

Basic Concepts

What are variables? What are data? What happens, when assignments take place? What are common misconceptions concerning the execution of an assign statement? Who acts during the execution of a program? What happens, when a function returns something? How do objects communicate? What is a message?

Modeling with lists

How can you model a group of persons by a list of lists? What happens, when a list (a mutual object) is changed? How can you visualize iterations?


What is the easiest way to imagine the execution of a recursive function? How do you proceed trying to assemble a recursive function from fragments of code? What kind of intuitive models help understanding recursion?


What are the intuitive ideas of different sort algorithms? How can you use assertations to check the correctness of a sort function? How can you transform an intuitive algorithm to a formal program?


When two persons are working together at one computer there are intense discussions about the visual models.

Ninety percent of the participants declare that they have got some new insights during the workshop.

Some teachers say, they will change their teaching methods and use visual models in the classroom.

© 2005 Michael Weigend