Public Group

# simple noob typing prob

This topic is 4116 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

----solved please see edit---- k guys I am learning python and have gotten the activepython installed, but I'm having a little problem with the shell log/input thing, the ">>>" I have tryed to write a simple loop, to get down sytax, but keep geting the ">>>" when I want to go to the next line. EX: a=0 while a<10 # when I press enter to go to next line it trys to excute a= a + 1 print a How can I fix this? Thanks, Joe P.S. should I just write it on notepad first? EDIT I figured it all out, just the tut doesn't show how to end a while statement and continue the program. can someone please tell me how. Thanks and sorry for the inconvenience, Joe [Edited by - avgprogramingjoe on June 14, 2007 10:01:28 PM]

##### Share on other sites
You need a ":" at the end of your while

EDIT: Oh, right. The edit.

##### Share on other sites
Yes thanks for your reply though. But how do I end a while statement.
EX
a=1
while a<10:
a= a + 1
### I don't want this to be part of the while statement.
print a

Thanks again,

Joe

##### Share on other sites
After you type a = a + 1 and hit enter you'll get another ... prompt. To end the indent block just press enter without typing anything. It will execute the while loop and then return to the >>> prompt.

Edit: Keep in mind that the interactive shell executes each line or block of code immediately after you enter it. You typically use it for learning and testing purposes but you don't actually write lengthy programs in it.

##### Share on other sites
Python uses indentation to mark out the blocks. If you start a block, Python will wait until you input a blank line, and then interpret everything up to that point as the block. Of course, everything under the first line will need to be indented at least one level, in order to be part of the block.

So it goes something like (with the text '<tab>' replaced with actual tabs, of course)

>>> for x in range(3):...<tab>print "hi mom"...<tab>print x * 2...>>> hi mom0hi mom2hi mom4

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632591
• Total Posts
3007250

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!