Programming
Workshop

Spring 2018
course
site

Thu Feb 1

We went over the work that you did this week.

I showed how to count things with a dictionary :

def count(stuff):
    """ return dictionary {item:count} """
    result = {}
    for item in stuff:
        if item in result:
            result[item] = result[item] + 1
        else:
            result[item] = 1
    return result

print "answer is", count(['a', 'a', 'b', 'a', 'c', 'b', 'a'])

I introduced the idea of "regular expressions" and went over a few examples.

And I discussed what we'll do next : piglatin in groups

https://cs.marlboro.college /cours /spring2018 /workshop /notes /feb1
last modified Fri April 19 2024 4:46 am