Hi Guys, Just on Problem Set 1: Paying Off Credit Card Debt. (A) I have the following code for the first program, and when I test it against the professors it's almost identical, it just has 0.01 or 0.02 off on one or two places. Anyway, my code is http://dpaste.com/1111574/ And the professors is .. http://dpaste.com/1111575/ I used a for loop and he used a while loop. Again my results are so damn close, is it something to do with the rounding? Can it be ignored or would i be down graded. Any other comments on which is more effective is appreciated. Cheers!!
no grades for the OCW courses. why do you suspect that it has something to do with the rounding? the shell is a great place to try out ideas to see how things work.
I know I don't get graded, but I like to know whether my code would get an A, or an F, if it I did the actual course. Now I don't think it's rounding, as I'm only rounding what's printed, not what's being processed each iteration. My uneducated guess is that its something to do with float numbers being weird, but yeah, i got no idea. Any clues?
what is different between your code and the 'professor's' code?
Tomyboy's guess about float numbers is correct, the professor addresses the issue in a future lecture, and specifically mentions this problem set as an example of the issue.
Join our real-time social learning platform and learn together with your friends!