anonymous
  • anonymous
i m doing lecture 2 now...i have pyhon 2.7.3 with me..when i m writing the if condition i could get until first print but after typing else and pressing enter i m getting a syntax error.please help
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
jamiebookeater
  • jamiebookeater
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
I m also getting the same error. But If you use if inside a function, you can avoid getting the syntax error.
anonymous
  • anonymous
Can you post the code that you have written .
anonymous
  • anonymous
here it is
1 Attachment

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
jagan,could u be more detailed abt using if inside a function...i dint understand what u said
anonymous
  • anonymous
in your program else should be below if statement >>> x=15 >>> if (x/2)*2 == x : print 'even' else: print 'odd' Do something like this >>> def test() : x = 15 if (x/2)*2 == x : print 'even' else : print 'odd' >>> test() odd
anonymous
  • anonymous
you have to maintain the indentation by moving the cursor back and forth using left and right arrow key.
anonymous
  • anonymous
this is what i got
1 Attachment
anonymous
  • anonymous
i still dont get it ...need ur help a lil more
anonymous
  • anonymous
ok you should do something like this def test() : # after test its not zero its these ( ) braces, press enter after typing this line x = 15 # just type x = 15 if (x/2)* 2 == x : # this line should start from where x variable starts ,press enter print 'even' #press enter else : # when you press enter the your cursor will be below p of print(previous line) move it left by using left arrow key print 'odd' #press enter #press enter again You will get a prompt like >>> type there test() # not zero but ( ) and press enter you will get the output.
anonymous
  • anonymous
thank u
anonymous
  • anonymous
The course does recommend a particular Python version, 2.5.4 I believe... however, all the 2.X versions are supposed to be backwards compatible with each other
anonymous
  • anonymous
thank u ryan...i got it

Looking for something else?

Not the answer you are looking for? Search for more explanations.