Problems with range
Chris Share
usenet at caesium.me.uk
Fri Jun 25 20:24:47 EDT 2004
On Fri, 25 Jun 2004 19:06:39 -0400, Adrian Albisser <justblame at 123.cl> wrote:
> Hey to everybody, im just beginning to program in python. So i was trying
> some function but always when i try the range function i get a error
> message.
>
> for number in range(1,100):
> print number
>
> Error---> There's an error in your program:
> expected an indented block
Read what the message tells you. The problem is not with your range
function, it's the rest of the program. In Python, indenting is
important; it tells the interpreter which bits go together.
So your program should be:
for number in range(1,100):
print number
Note the 4 spaces at the start of the second line. It doesn't have to be
4 spaces, but that's convention.
I'd suggest you read a good python tutorial - I like
http://www.freenetpages.co.uk/hp/alan.gauld/tutintro.htm
And of course there's http://www.python.org/doc/current/tut/ on the
python site itself.
chris
More information about the Python-list
mailing list