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

Hey I just started learning and am getting a syntax error on this.please help x=float(raw_input('Enter a number: ')) if x%2==0: print 'Even' else: print 'odd' If x%3|=0: print 'Not divisible by 3' What's wrong with this code?

OpenStudy (anonymous):

The syntax is != rather than |=. Maybe it's that.

OpenStudy (anonymous):

No,it shows x as syntax error in x%3

OpenStudy (anonymous):

if x%3 != 0

OpenStudy (anonymous):

Did you try? Error output is unclear sometimes.

OpenStudy (anonymous):

Yeah I did,it says syntax error and highlights x.I corrected the !

OpenStudy (anonymous):

How about if instead of If. Like: http://codepad.org/9Np5tkxv

OpenStudy (anonymous):

Oh yeah got it.Thanx for the help.I just started so I didnt notice it

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!