Homework + next class

1 view
Skip to first unread message

Robert Cezar Matei

unread,
Aug 11, 2010, 2:44:18 AM8/11/10
to learn-...@googlegroups.com
Hi kids, 

Sorry it took me a while to get this out. If you missed the class, I recommend just looking at the class notes - you may be able to follow along as we didn't add many new concepts.


Review: 


Homework: 

Download this script. If you run it from the Terminal (python ~/codeclass/weather.py), you should get the following error: urllib2.HTTPError: HTTP Error 400: Bad Request

Your task is to make the script work - it only takes a one-character change. Debugging non-working code is probably the most important skill you can pick up at this point, but it'll take a bit of mental adjustment. Here's how you should approach it: go sequentially through each line of code in the order they're executed, and add print statements to see the intermediate state of the variables being worked on. For instance, if you have:

x = make_api_call()

you turn that into:

x = make_api_call()
print x

You want to do that after every significant line in the script. Then look at the output of the print statements and see if anything looks wrong.

I recommend getting into groups to work on the homeworks - you'll probably learn more and definitely have more fun. Self-organize on the list!


Add-on problem (optional, good practice): 

Modify the working weather.py you just fixed to only print out the hottest city in America at the time.


Full-timers:

Luke's not working wants to spend a lot of time learning this stuff. I'll create a side group of people interested in spending more time on this and probably working on a real side project. Who's down? Contact me and Luke (dill...@gmail.com) and we'll talk about what you guys can work on.


Vote for next class:

What time works for you?

I'll run one more class in the next two weeks, then I'll probably be out of the country for a while, but I'll see if one of their TAs can do more sessions until I'm back. 

See you at the next one :)

--
-Robert/Cezar

(I usually only answer e-mail a few times a week to maximize concentration, so I apologize if my response time is slow.)

Robert Cezar Matei

unread,
Aug 12, 2010, 2:41:43 AM8/12/10
to learn-...@googlegroups.com
Download this script. If you run it from the Terminal (python ~/codeclass/weather.py), you should get the following error: urllib2.HTTPError: HTTP Error 400: Bad Request

You might also get a KeyError error; this is fine, just work on fixing the problem :)
Reply all
Reply to author
Forward
0 new messages