Course Level
CS1
Knowledge Unit
Fundamental Programming Concepts
Collection Item Type
Assignment
Synopsis

In this assignment students work to write a program that simulates a random walk. Using recursion, students must write a function that continuously randomly selects left or right and keeps track of how far the random walker has moved. They must then analyze their random walks to find how far the random walker travels on average. In addition to reviewing recursion and random number generation, this assignment requires students to create debug statements that print additional information. It is particularly useful for students who are new to recursion and need additional practice debugging.

Recommendations

Integrate pair programming when it is appropriate for students to collaborate on a lab, assignment, or project. The “driver” controls the mouse and the keyboard, while the “navigator” makes suggestions, points out errors, and asks questions. Partners routinely switch roles to gain the benefits of each role.

Engagement Highlights

Students choose how to display their random walk as a way of Incorporating Student Choice. Puts the random walker in the context of a sleepwalking student as a way of providing Meaningful and Relevant Context.

Materials and Links

Computer Science Details

Programming Language
Python

Material Format and Licensing Information

Creative Commons License
CC BY-NC