range(0, 5)
CSCI 1012
last_digit.py
pizza_party.py
odd_string.py
.zip
with all the .py
files
check_even.py
vs. checkEven.py
def check_even(x):
vs. def check_evens(x):
1 2 3
vs. 1 2 3
Read your autograder output!
while
loopfor
loopTrue
and False
if
statementselif
else
Values:
False
x == 3
is an expressionFalse
y
is assigned False
True
True
False
True
False
False
if
elif
else
and
executes if both sides are True
or
executes if either side is True
not
“flips” the truth valuex
will be an integerTrue
if x
’s last digit is 0 or 1
False
while
loopif
statement:
True
while
loop:
True
while
5
while
loops need a “stopping condition”while
looppizza_party.py
True
if one pie can be equally shared by the number of people
people
can equally share the slices
pizza_party(2)
returns 1
pizza_party(6)
returns 3
pizza_party(5)
returns 5
for
loopwhile
loop:
while
loop has “indeterminate” number of iterationsrange
range
in Python is a special “collection”
range
functionrange(0, 5)
range
with for
loop0
1
2
3
4
for
Loopodd_string.py
odd_string(5)
should return "1 3 5"
odd_string(8)
should return "1 3 5 7"
Reading: Think Python Chapter 6
Homework 5 due Sunday, 16 Feb 11:55 PM