Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 26 Online
OpenStudy (anonymous):

In ps1, Problem 3, I am stumped, and checked out the sample solution to see if it was something I ever would've figured out w/present knowledge. There was some stuff in there I hadn't learned yet. Do I just need to study the reference materials in more detail, or will this stuff be covered later? I semi-understand the 'for month in range' statement, but why is the range (1,13) rather than (1,12)? And, when I tried to use 'while month <=12' and 'month = month +1' in place of the 'for month in range(1,13)' loop, it seemed to create an infinite loop. Where did I go wrong?

OpenStudy (anonymous):

Apologies! Didn't notice that I SKIPPED right to ps1 without watching the recitation after Lecture 2, or Lecture 3. The missing pieces are probably in there :)

OpenStudy (anonymous):

As for the (1,13) part - in a for loop the first number is 'inclusive' and the second is 'exclusive' meaning if you include the 1 and exclude the 13 you get 1-12 essentially. As for the while vs the for loop - they could essentially be the same thing but depend on how they are implemented in the code.

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!