4
CSCI 1012
Q: What’s going to be on the quiz?
A: Everything through the last homework
.zip
with all the .py
files
“Small units of computation”
What was printed?
nothing
The print
function
4
=
evaluated=
gets result4
Reassignment:
4
8
Operator | Function (with numbers) |
---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
** |
Exponentiation |
// |
Quotient |
% |
Remainder |
They behave differently with text:
They behave differently with text:
3
They behave differently with text:
3
They behave differently with text:
3
harbor
This code should:
y
y
by 5y
y
y
Desired output:
7
35
36
Submit on the submit server!
Anatomy of a print()
statement:
print
()
The print
function is special:
print
print
2
print
2
2
print
2
2
None
1.25
1
int
function called on 1.25
(a float) returns 1
(an int)int
- integer, whole numbersfloat
- numbers with decimalstr
- “string” - text informationint
, float
, and str
convert between types
type
tells us the type of a variable4.0
55
Error! Why?
Function with argument:
exercise_2
"Today is January 27"
on one linelecture3_02.py
Submit on the submit server!
Math:
\(f(x) = x + 1\)
Python:
Definition:
4
Code in the visualizer
4
5
exercise_3
2
repeated becomes 22
12
repeated becomes 1212
lecture3_03.py
Submit on the submit server!
Reading: Think Python Chapter 5
Homework 3 due Sunday, 2 Feb 11:55 PM