Intro
Programming
with
Python

Spring 2018
course
site

Feb 26

aside: today's xkcd


functions

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

homework

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.

https://cs.marlboro.college /cours /spring2018 /python /notes /feb26
last modified Sun December 22 2024 10:06 am

attachments [paper clip]

  last modified size
TXT ants.py Sun Dec 22 2024 10:06 am 4.2K
TXT average.py Sun Dec 22 2024 10:06 am 548B