Hi everyone my name is Sam.I just started studying at ocw 6.00SC and some how am stuck at how to use how to use to the while statement.I can understand the if elif else i mean when i am just using <,>,==, != long with integers or float but when it comes to solving real problem with it, like say cube root, i begin to think i don't have a brain.I can't understand how the codes are fomed.I don't know when if or elif or else or while should come in.lecture 3 in ocw 6.00CS ie problem solving is my problem can anyone help?am desperate n will to learn how to program
here try this he can really help you https://www.thenewboston.com/videos.php?
while statements frame loops. In English, do the indented commands WHILE this condition is true. In code: while( 2 > 1 ): print "Boring, isn't it?" The condition, in this style, is inside the parenthesis. This loop will run forever. An if statement kind of just frames a condition and branches based on whether the condition is true or not. if( 2 > 1 ): print "No kidding." elif( 2 == 1 ): print "Not likely" else: # any other outcome print "Didn't happen" Other languages require the parenthesis, Python allows them.
you guy where really helpful thanks a lot.
Join our real-time social learning platform and learn together with your friends!