There's an error in the second part of the code sheet : http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/unit-1/lecture-2-core-elements-of-a-program/MIT6_00SCS11_lec02.pdf To be exact : if x < y: if x < z: print 'x is least' else: print 'z is least' else: print 'y is least' Am I the only one getting wrong answers with this code ??? Thank you
enclose your code in back ticks ``` or use a code pasting site like http://dpaste.com
What is the error?
Yeah, it's wrong because it doesn't check the value of z if x<y. The code should give the right answer if you use a "elif" statement on that second else, like in the block right after the one you posted, on the sheet. That's why these sheets don't make sense outside of the lectures. :P
Ah ok, it's just he didn't talk about it at all. Thank you !
Join our real-time social learning platform and learn together with your friends!