aside: today's xkcd
In class we went over my ants song code and looked at functions to find an average with tests.
I also mentioned default variables for functions, i.e.
def do_something(size, color="white"):
print "size, color = {}, {}".format(size, color)
do_something(3, "blue") # this is OK
do_something(4) # also OK; color defaults to "white"
do_something() # *not* OK; 0 args gives error
I've posted the homework for the next several weeks, all the way to the week after spring break when the midterm programming project is due. Check out the assignments page for the details.
We're doing chapters 7 & 8 on conditionals next. Start reading that, and check out my 2016 notes : part 1 and part 2.
last modified | size | ||
ants.py | Sun Dec 22 2024 05:03 am | 4.2K | |
average.py | Sun Dec 22 2024 05:03 am | 548B |