Days 112-3: Reading Python

Wednesday, 12 February and Thursday, 13 February 2014


I haven’t taught my kids the first thing about coding. If they know something from previous learning, I’d be surprised. So, before winter storm Pax bore down on Atlanta, I had the kids install python and visual. Late Tuesday night, I sent them a remind101 text message to check on the assignment on our Moodle site.

The kids had to watch the video and answer the questions I asked:

  1. When writing computer programs (“code”), what is the purpose of a comment? 
  2. What symbol marks the beginning of a python comment?
  3. According to the script around line 70, W = -ball.m*g. Using values from earlier in the script, what is the weight of the ball we’re modeling?
  4. Also according to the script around line 70, Fd = -b*ball.vel. How would you expect the drag force to change as the ball’s velocity increases? (What is this kind of mathematical relationship called?)
  5. Something special is happening around line 73: ball.vel = ball.vel + g*deltat. It might look like bad math to you. So it’s a good thing it’s not math but code! This line means take the old ball velocity, add g*deltat to it and store it in the new ball velocity. In code, that equal sign is called an assignment operator. Which kinematics equation does this most closely represent?
  6. Around line 77, this: t = t + deltat. Based on what you just learned above about assignment operators (=), what’s happening here?
  7. Line 66 is the beginning of a loop. It says “as long as the time is less than 0.5s, keep repeating this section until the indented code ends. Look inside the loop (the indented stuff) and tell me what you see happening there.
  8. Given that deltat is 0.001s and the while loop says “while t<0.5”, how many loop repeats do you think will occur?

The toughest question proved to be 7, probably because I asked them to actually think on this one. Here’s my favorite response:

Screen Shot 2014-02-13 at 4.59.47 PM


In question 4, I asked how the drag force varies with a ball’s velocity. The code says Fd = -b*ball.vel. Most kids had the right idea, along the lines of this one: “as the ball’s velocity increases, the drag force would also increase, this is a positive correlation.”

The last question asked how many times the while loop would be repeated. The code said “while t<0.5, with increments of 0.001 from an initial value of 0”. So the correct answer is 500 (or 0.5/0.001). Probably 90% of the kids got this one right! Remember, they’ve never seen code before.

This assignment is phase one of my computational modeling work I’m doing with the help of the Georgia Tech PER Group.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s