[Tutor] what is wrong with this syntax?
Dipo Elegbede
delegbede at dudupay.com
Tue May 18 17:55:33 CEST 2010
thanks Steven. I'll always be mindful of that.
By the way, I need someone to briefly explain to me how the while loop works.
a little on break will also do.
thanks.
On 5/18/10, Steven D'Aprano <steve at pearwood.info> wrote:
> On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote:
>> ples help me figure out what is wrong with this syntax?
>>
>>
>> print('Here are the numbers from 0 to 9')
>> for i in the range(10):
>> print(i)
>>
>> thank you.
>
> Others have already given you the answer, but more important is for you
> to learn *how* to get the answer.
>
> Look at the error message Python prints:
>
>>>> for i in the range(10):
> File "<stdin>", line 1
> for i in the range(10):
> ^
> SyntaxError: invalid syntax
>
>
> You get a SyntaxError, which tells you that what you've written makes no
> sense to the Python compiler. It also tells you that the error has
> nothing to do with either of the print lines.
>
> Unfortunately Python isn't smart enough to recognise that the problem is
> with "the" rather than "range(10)", but it points you to the correct
> line.
>
>
>
> --
> Steven D'Aprano
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Elegbede Muhammed Oladipupo
OCA
+2348077682428
+2347042171716
www.dudupay.com
Mobile Banking Solutions | Transaction Processing | Enterprise
Application Development
More information about the Tutor
mailing list