Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 18 Online
OpenStudy (espex):

For Review: I mocked up "Exercise OPT.1 – Zeller’s Algorithm" http://pastebin.com/59iL8cXH

OpenStudy (espex):

Seems I forgot December in my code. :) http://pastebin.com/c4Rhdavv

OpenStudy (espex):

One bore bug found/fixed. The else statements were allowing the user to bypass the checks. http://pastebin.com/rkA34n8e

OpenStudy (espex):

My third debug. There was an issue in the month section that would go into an infinite loop if you had a 2-digit number that was outside of the standard 1-12 range. Hopefully this is it. http://pastebin.com/wyyZCTxL

OpenStudy (anonymous):

This is Python 3, right?

OpenStudy (espex):

It is, yes.

OpenStudy (anonymous):

Reading this impresses on me the need to control input. The vast majority of your code is making sure users give you input your code can use. That's a good lesson. The version I wrote works only when the user knows what to enter. https://gist.github.com/TomDeBeauchamp/5872762

OpenStudy (espex):

It is worth noting that I started with code very similar to yours. Only once I had the underlying logic working did I start to explore the input control.

OpenStudy (s.campbell):

That's a lot of input control. My design goal was to get this over with and I typo at a fairly high rate, and so I skipped the input checking and went with ease of input. For the initial coding, I set strings to month, day, and year. Here's a link to my Python 3 answer, if you want to compare input styles. https://gist.github.com/scampbel/5888834#file-ocw_zellers-py (and I wanted to test posting a link to code :-)

OpenStudy (anonymous):

My attempt is here: https://github.com/gregsmyth/MOOC_homework/blob/master/zeller.py The main bug I encountered was forgetting how the slicing indices relate to the spaces between elements.

OpenStudy (anonymous):

Finally had some free time to start catching up. Here is mine, without error checking. http://pastebin.com/0w4dESPx

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!