CS 115 Reading: Week 2
Variables and assignment (started last week)
We started on these topics at the end of Week 1. By the end of Week 2, you should be very comfortable with:
- Defining variables using assignment statements
- Keeping track of the changing values of a variable during the execution of a program
- Printing a mix of variables and literals
- Using input to assign values to variables
- Combining these elements to write programs, given an English description of what the program should do.
Suggested readings:
- Sections 2.1–2.5 of Zelle
- The following sections of Miller and Ranum:
Data types (str, int, and float)
By the end of Week 2, you should be comfortable with:
- Deciding what data type is appropriate for a particular type of data (for example, a person's name, a number of students, an amount of money...)
- Figuring out the data types of variables in Python programs by analyzing the source code.
- Defining and using variables for numeric data
Suggested readings:
Arithmetic
By the end of Week 2, you should be comfortable with:
- Using the following arithmetic operators in your Python programs, and correctly applying order of operations:
- + (addition)
- - (subtraction)
- * (multiplication)
- / (floating-point division)
- // (integer division)
- % (modulus or remainder)
- ** (exponentiation, a.k.a. taking a number to a power)
- Using the sqrt() function and pi constant from the math library
Suggested readings:
Definite (for) loops
By the end of Week 2, you should be experimenting with:
- Using for loops to execute blocks of code repeatedly
- Tracing the sequence of values taken by a loop counter variable
- Using range to manipulate a loop counter
Suggested readings: