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

Is there a way to write code in a way that when I press enter, the code does not run? I'm also wondering why I can not write two if statements. I get a syntax error when I try. Here is the code. >>> x = 15 >>> if (x/2)*2 == x: print 'Even' else: print 'Odd' if x == 15: print 'FIFTEEN' else: print 'NOT FIFTEEN' SyntaxError: invalid syntax >>>

OpenStudy (anonymous):

The SyntaxError highlights the second if in red.

OpenStudy (anonymous):

ctrl-c will stop execution in the idle shell - you might have to hold it down if it is in a dee recursion. this will preserve any variables. ctrl-F6 will restart the idle shell Idle: select New Window from the File menu - write your code in there and F5 to run it

OpenStudy (anonymous):

Thank you for your response. I typed the code into a "New Window" and ran the module and it worked. What is the difference between the "New Window" and the IDLE Shell?

OpenStudy (anonymous):

the "new window" lets you create 'modules' with multiple statements/expressions/code blocks. apparently the idle shell only lets you run/evaluate a single compound statement - it wants to evaluate it immediately

OpenStudy (anonymous):

I really appreciate your help. Thanks again.

OpenStudy (anonymous):

the idle shell is a great way to test things out (prototyping) when you are trying to figure out how to do something

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!