CS 115 Lab 6, Spring 2015
Deadlines
- Pre-lab: Tu 2/24/2015 at 7 AM
- Writeup and code (lab06c.py): Tu 3/3/2015 at 4 PM
- Demo (parts A and C): Any lab section, workshop, or open tutoring session before Tu 3/3 at 4 PM. Your last chance is the Tuesday tutoring from 3-4 PM.
Goals
Upon successful completion of this lab, you should be able to understand and write programs
using while (indefinite) loops.
Pre-Lab Assignment
Click here for the pre-lab instructions.
Even if you didn't get to the pre-lab by the deadline, you should work through it before proceeding with the rest of the lab. A PDF of the
pre-lab is available on Moodle.
Setup
- Before you start writing code, you will set up a directory for this assignment
on the cwolf server. To connect to cwolf, do one of the following:
- Enter your CS 115 subdirectory by typing
cd cs115
- Type pwd (print working directory) and verify that the output is:
/home/student/yourusername/cs115
- Create a directory for Lab 6 by typing
mkdir lab06
- Enter your Lab 6 directory by typing
cd lab06
- Type pwd again, and verify that the output is:
/home/student/yourusername/cs115/lab06
- Decide whether you want to work directly on cwolf ([remote]) or work on IDLE at your local computer ([local]), and follow the relevant instructions for the rest of the lab.
Lab Instructions
Follow the links below to complete each part of this lab.
- Basic while loops: the Collatz sequence
- Find the largest power of 2 less than a number
- Write a number as the sum of powers of 2
- Submit your assignment