Fall 2019

# assignments

## 1. getting started due Tue Sep 10

• Read chapter 1 in the text.
• Install python version 3 on your computer and take it out for a spin. Check out the resources page for some hints. (If you don't have a laptop, talk to the folks in the computer lab and/or Jim and we'll see what we can work out.)
• Run the "chaos" python program from the first chapter. (We'll discuss the nuts and bolts of how to do this in class.)
• Try some of the exercises at the end of chapter 1.
• Tell me about your tech and computer background - including what kind of computer you're used to using, what you'd like to get out of this class, and how well first assignment went for you.

## 2. functions, input, print, loops due Tue Sep 17

• Read chapters 2 & 3.
• Look up the definition of the built-in range() function in the python docs (see the resources page or google it). Try it at the python prompt and explain what it does.
• Do chapter 2 exercises 1, 7, 10 (page 54 & 55).
• Do chapter 3 exercises 12, 14, 16.
• Let me know how all this is going.

## 3. graphics and objects due Thu Sep 26

• Do chap 4 exercise 3 (draw a face).
• Do chap 4 exercise 9 (rectangle information).
• Describe briefly in your own words and give a code example for the following concepts:
• class
• instance
• method
• argument
• Write a graphics program of your choice - make a random artwork, animate something, use mouse clicks to draw - whatever. (This doesn't need to be too fancy - we will have more coding tools like "if" statements later to do more.)

## 4. strings, lists, files due Tue Oct 1

• Read chapter 5 in the text.
• Do these programming exercises from this chapter :
• 4 (acronyms) or 5 (name sum)
• 7 and/or 8 (on the Caesar cipher),
• 12 (formatted numbers), and
• 14 (read and summarize a file)
• As always, be smart about the time and effort spent on this stuff. If it's too much, focus your attention on a few. If it's fast, turn up the juice on some aspect that seems interesting.
• If you get stuck, please do find or email me or Nick and/or talk to other folks in the class. Often times a small hint can get you over a hump.

## 5. functions due Thu Oct 10

• Describe briefly the following notions, and give a code example.
• return value
• local variable
• global variable
• argument
• Do programming exercise 2 from chapter 6 (the ants song).
• Do programming exercises 11 through 14 from chapter 6 (ending with the sum of squares of numbers from a file).
• Re-write any program a from previous assignment using functions for some parts of the code. For a really good time, put in docstrings and doctest tests too. :)

## 6. decisions due Thu Oct 17

• Do programming exercise 6 (speeding ticket).
• Do programming exercise 12 (date validation).
• Do programming exercise 18 (exceptions).
• Propose a midterm coding project idea so that I can give you some feedback. The Oct 8 course notes has a list of topic ideas. (That assignment is listed below, though it isn't due for several weeks, so you can see what I'm asking for.)

## 7. booleans due Tue Oct 29

• Do these two programming exercises. Both will need loops or loops-within-loops, if statements, and (probably) helper functions.
• Write a python program to verify that not (a or b) is the same as (not a) and (not b) by brute force, i.e. by looping explicitly over all possible assignments of True and False to a and b and checking. This is one of "De Morgan's Laws" of Boolean algebra. (My Tue Oct 14 notes have code that starts something similar.)
• Start working on your midterm project and let me know how that's going.

## 8. midterm project due Tue Nov 5

• Write a midterm coding project of your choice, using what we've done so far and demonstrating your mastery of it. Your submission should include
• the source code itself, including appropriate docs and comments.
• output : what it looks like when it runs
• a brief write-up explaining what you did, what it's supposed to do, what was easy and what wasn't, and discussing the technologies involved.
• include a bibliography of any resources (websites, books, ...) you used
• Your grade will be based on the following evaluation categories :
• concept : the technical merit of the idea itself, including its difficulty and planning
• mastery : how well the project shows your understanding of the course material
• style : the clarity of your code and other materials, and whether it follows accepted conventions
• completeness : does it feel finished, and what bugs are there
• support : appropriate docs, tests, sample output, screenshots, etc

## 9. classes due Tue Nov 12

• Write a short python program that
• defines a class of your own invention, representing a "thing" of your choice
• includes an __init__ and __str__ method
• includes at least three other methods, some of which take arguments, some of which return things, which modify the object's values and/or print things out
• has a main() function that creates several instances of these classes and calls some of their methods to do whatever it is that your "thing" does.
• Do exercise 11 in chapter 10, implementing a playing card object.
• Modify any program you've written previously this semester to include a class definition.

## 10. data collections due Tue Nov 19

• Look at programming exercise 15 in chapter 11: blackjack. Write code along those lines that has classes for a Card, a Deck, and a BlackJackHand, which lets you at least deal a hand and have a method that gives its blackjack value. The specific methods and connections between these classes are up to you. Optionally, use these classes (and possibly others such as Player or Game) to simulate a blackjack game.
• Propose a final project - same scale and concept as the midterm, but also demonstrating the new material we've seen in the second half of the term.

## 11. algorithms due Tue Nov 26

• Work on your projects - post whatever you have so far, along with your thoughts.
• Read chapter 12, object oriented design.
• Start looking at chapter 13, algorithms and recursion.
• No written problems this week, other than the project.

## 12. final project presentation due Tue Dec 10

• Come to the last class ready to show your final project to the class.
• Simplest is to post something here that would let Jim share code or screenshots.

## 13. final project submission due Fri Dec 13

• Submit your final project writeup here.
• Rules are the same as the midterm - submit your code, a description of what you did, a bibliography, and show what it does when you run it.
• If you need more time, ask for an extension to Monday.

## 14. semester grade due Tue Dec 17

a place for Jim to leave final comments