About Python syntax:
Indentation determines flow and works with blocks of code. And every level if indentation must be equal in length. You can choose between blank space or tabs, but since Rhye uses blank spaces you have to also. In fact, Rhye uses eight blank spaces - this means that the first level is zero blank spaces, the second one is 8, the third 16 and so on. (A good Python editor will let you define the amount and type of whitespace you wanna work with and then you use the tab key to move up one "level".)
Example:
Code:
iVariable = 0
while iVariable != 42:
print (iVariable, "wrong number!")
iVariable += 1
print ("right answer:", iVariable)
The code starts on "module level", also known as __main__. The while command creates a loop and the colon at the end of line #3 indicates that a new block of code should be inserted. This is why the following two lines - the ones that are part of the loop - are indented one level (= 8 blank spaces). The last line is not part of the loop, so it is not indented.
So the rule is: Add one level worth of indentation after every colon.
When to end a line with a colon? Well, any time you use a logical statement, I guess... (You don't need to indent for assignment statements, like the first line in the example. But then again, there's no colon either.)
Just so I haven't confused anyone, this also works:
Code:
iVariable= 0
while (not iVariable ==42):
print iVariable,
print "wrong number!"
iVariable = iVariable+1
print "right answer:",
print iVariable)
So there are some options when it comes to syntax. Note that I only used four blank spaces for indentation and it works just the same. (But then I'm stuck with that for the entire module, or file.)