ECS 10, Basic Concepts of Computing Spring Quarter 2009
Version of April 2, 2009 at 7:10 AM Page 1 of 1
Outline for April 3, 2009
Reading: text, §2.1–2.3
1. Software development
a. Analyze the problem
b. Determine specifications
c. Create a design
d. Implement the design
e. Test/debug the program
f. Maintain the program
2. Example: program to convert temperature
a. Do we go from Fahrenheit to Celsius, Celsius to Fahrenheit, or both?
b. Go from Celsius to Fahrenheit
c. Steps in the program:
i. Ask user for temperature in Celsius
ii. Convert to Fahrenheit (using well-known formula)
iii. Print result in Fahrenheit
d. Implementation: see tempcvt.py
3. Example: sum of first n numbers
a. Do we include n or not?
b. Begin at 1, add numbers up to and including n
c. Steps in the program:
i. Initialize total to 0
ii. Ask user for number
iii. Count from 1 up to number
1. Add each number to total
iv. Print result
d. Implementation: see sum.py
e. It doesn’t work—show how to debug it (see sum2.py for working version)
4. Variables
a. What they are
b. Names, identifiers
c. Legal, illegal names
d. Reserved words
5. Expressions
a. Operation, operand
b. Operators +, –, *, /, %, **
c. Name Errors