Outline for January 18, 2012
Reading
: §2, 3
Software development
Analyze the problem
Determine specifications
Create a design
Implement the design
Test/debug the program
Maintain the program
Example: program to make change, version 1 [
change1.py
]
Comments
Break down change into quarters, dimes, nickels, and the remainder is pennies
Function
input()
gets input as a string from user
Function
int()
converts data to a floating point number
Assignment to variable; evaluate right hand side first
print
statement
Now a while loop until user says to quit
Logical tests:
==
,
!=
,
>
,
>=
,
<
,
<=
Loop variable
go_on
initialized to enter loop
Loop variable reset at end
Variables
What they are
Names, identifiers
Legal, illegal names
Type converter functions
int
,
float
,
str
Expressions
Operation, operand
Operators
+
,
-
,
*
,
/
,
//
,
%
,
**
String operators
+
,
*
A PDF version is available here.
ECS 10, Basic Concepts of Computing
Winter Quarter 2012