Picture
Although there are lots of resources available on the web to help students learn Visual Python, I wanted to write about my own experience getting the process started in a classroom. This post represents my distilled experience in both AP Physics - Mechanics C, and in an algebra-based physics class with sophomores and juniors.


Lesson Plan

Below is a detailed lesson plan I did in class with my students. My school operates on a block schedule with 75 minute blocks per class:


1.  Students open IDLE environment. If the shell opens, have them open a new window.

2. Have them type the following code:
from visual import*
sphere()
3.
Picture






At this point have students open the tutorial document. Explain the following points to them:
  • They will write an app for a bouncy ball bouncing around a box.
  • Don't worry about why the code has the form it does. Just as babies learn a language by hearing and repeating words, so do we learn programming.
  • The tutorial will at first be simple commands. They should type these and run the code after every line.
  • As the tutorial goes further, they will be expected adapt previous code to solve new puzzles.
  • They may find the coding frustrating at first, but if they have some patience they'll be hooked soon enough
4. Let them begin coding and circulate around the room.

5. As the students code, they will find that the code does not behave as they think it should. The language in the tutorial explains why. Draw their attention to this in the tutorial

6. When a student succeeds in making a ball bounce off a wall, have the student walk you through the logic of why the conditional works to make the ball bounce. The code looks like this:

if ball.pos.x > wallR.pos.x:
    ball.velocity.x = -ball.velocity.x
7. They will then realize that bouncing off a second wall requires a tweak to this code. Walk them through the logic and only give them more help if it seems that they will not be able to figure it out.

8. They will find themselves more or less self-sufficient at this point. Some will be comfortable enough that they will experiment with different colors, ball sizes, rates etc. This is all to the good.

9. If students are done early, give them additional challenges such as
  • add extra bouncy balls (easy)
  • customize colors (easy)
  • incorporating gravity into their code (medium)
  • creating a diagonal wall and have a barrier inside their box and have their ball bounce off it (hard)

Before Class

0.  Each student should have a single laptop or desktop computer with Visual Python installed, and the document Vpython_Intro.pdf

1. VPython Website to download and install VPython:

2. Link to the tutorial (click where it says Tutorial) or just download the attached file below

3.  Lesson plan summary to download and have on-hand in your classroom:


vpython_intro.pdf
File Size: 125 kb
File Type: pdf
Download File

vpython.intro.lesson.plan.doc
File Size: 31 kb
File Type: doc
Download File

Caveats

It has been my experience that after the first few minutes of independent coding, they will start making many syntax errors. When this happens inform them that common errors include misspellings, improper indentation, and missing punctuation. Remind them that this is what they should check for whenever their code fails to run.

Also when they have to adapt their code to new problems, there may be some initial resistance. Asking probing questions and having them explain how their existing code works often gives them the ability to deduce what their new code ought to look like.

Finally, some kids will be very comfortable with code, and others may need more help. After awhile the students will probably start looking at each others code to get ideas. I have found this to be a good thing, in that the majority of students are engaged and are looking for a small hint to get them through a challenge rather than copying and pasting code.

Finished Product




Leave a Reply.

    Riaz Abdulla

    I hope that this blog becomes a useful resource for teachers to find lesson plans, code, and ideas for getting their high school students to explore the science of Mechanics via computational physics and Visual Python.

    Archives

    June 2012

    Categories

    All