COMP151 - Lab 1
For your first lab you’ll be working on a series of small problems in order to get comfortable with JES and Python. Don’t forget that at the end of chapter 2 there is quick Programming Summary section that provides a quick dictionary of all of the important functions and type names introduced in the chapter. When you run into problems don’t forget to check the Common Bugs and Debugging Tips scattered throughout the chapter as well.
From Chapter 2 do the following problems: 2.17, 2.23, 2.24, 2.26, 2.27, 2.29, 2.30, and 2.31.
- Switch the driver (person typing the code) and navigator (person watching, helping spot typos, etc.) on every new problem.
- The first four problems simply ask what output you’ll see from sequence of python commands. For these problems you should decide what the output should be then use JES to run the code interactively and check your answer. The navigator should, on a separate sheet of paper, record the output, whether or not you predicted it correctly, and if not, how you account for the discrepancy between what you expected and what actaully happened.
- Problems 2.27 and 2.29 ask you to type function definitions in the Program area of JES then run them. Treat these like the previous problems. Predict what should happen before you run it and record the results on a separate sheet of paper. Print the python code to hand in along side your lab commentary.
- The final two problems ask you to debug code. Find and fix the problem. Check yourself using JES and recorde a description of the problem and it’s solution along with your comments on the previous problems.
When you’re done or when time is up, whichever comes first, print the code from 2.27 and 2.29 and hand it in along with your hand written comments for each problem.