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

Anyone else have issues running indenting in the Python shell? I can get the code to work for submission but cutting and pasting, but the shortcut (CNTRL + ] ) does not seem to function correctly. After first indent following "if" statement with print command, I cannot get the "else" line not to trigger syntax error. Probably overlooking something pretty obvious again...

OpenStudy (anonymous):

post the code that's giving the syntax error

OpenStudy (rsmith6559):

Auto indent basically just indents the new line as much as the previous line. As good a guess as a machine can make. An else: clause is the same indentation as the if statement if belongs to. I dislike idle because it seems to use only spaces for indentation. I usually use tabs. They are not equivalent, and cause syntax errors that are hard to track down.

OpenStudy (anonymous):

One tip in Idle is that if you use the 'Check Module' under the 'Run' menu it can sometimes help you find whitespace problems.

OpenStudy (anonymous):

write your code in an editing window instead of the shell File | New

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!