Python Programming

the revolution will not be televised

Monthly Archives: October, 2012

Coursera: Week 5

Learn to Program: The Fundamentals  Week 5 - while loops, lists, mutability This week I learned that, of course, I’ve been doing it all wrong. Guido van Rossum has decided that there’s no room for individuality, and Python script must be standardized. To quote from Intermezzo: Coding Style: “Name your classes and functions consistently; the convention is …

Continue reading

Coursera: Week 4 – Is It For You?

Learn to Program: The Fundamentals  Week 4 - for loops, fancy string manipulation This is the week I discovered I’m an addict. It was Friday, I had a long to-do list, but made the mistake of checking my e-mail. Oh, the lectures and assignment for the following week are already up. Fast-forward 6 hours and I …

Continue reading

Coursera: Week 3 – Beginner Tips

Learn to Program: The Fundamentals  This is from the syllabus:  Week 1 - Installing Python, IDLE, mathematical expressions, variables, assignment statement, calling and defining functions, syntax and semantic errors Week 2 - Strings, input/output, Booleans, function reuse, function design recipe, docstrings Week 3 - import, namespaces, if statements As you can see, it’s fairly rigorous. One of the …

Continue reading

Brush Up Your Quadratic Equations

Python Programming: Chapter 7, Exercise 18. I’ve been playing with this all afternoon, trying to get the bugs out. Can’t really vouch for the math. It seems to work – at least it did five minutes ago – but when I try to shorten the code (all those mu equations), it weirds out, so I …

Continue reading

Archery Scorer

Python Programming: Chapter 7, Exercise 16. I used ten-band scoring, with the bull’s-eye worth 11 points. Again, the code could be shorter – but that’s not the purpose of the exercise.

Continue reading

Does a Line Intersect the Circle?

Python Programming: Chapter 7, Exercise 14. I usually post code for exercises that were either fun to do or required research or gave me a headache. This exercise was none of the above, but I’m posting it because I use it later on, for exercise 18.

Continue reading

Date of Easter from 1900 to 2099

Python Programming: Chapter 7, Exercise 10. More doctests.

Continue reading

Date of Easter for the Years 1982-2048

Python Programming: Chapter 7, Exercise 9. Most of this is from ReexamPracticeQuestionSolutions.pptx (or in my case, .odp). You can download it at: http://www.csee.usf.edu/~rtindell/courses/Python/Solutions/

Continue reading

A babysitter charges $2.50 an hour…

Python Programming: Chapter 7, Exercise 7. I used a 24 hour clock because I’m not a masochist.

Continue reading

Quiz Score to Letter Grade

Python Programming: Chapter 7, Exercise 3. Thought I’d take the opportunity to try out some docstrings. If a test fails, it produces an error message in the interpreter.

Continue reading

Follow

Get every new post delivered to your Inbox.