(no subject)

Neil Macneale mac4-devnull at theory.org
Thu Aug 16 22:22:39 EDT 2001


In every code snipet, I see different problems. Some of then I am not
sure how you achieved...

this works for me:

>>> a=0
>>> b=1
>>> while b < 1000:
...     print b
...     a,b = b,a+b
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
>>> 

crombie <crombie88 at yahoo.com> wrote:
> newbie question:
> trying to type this in:
> >>> a, b = 0, 1
> >>> while b < 1000:
> ...     print b,
> ...     a, b = b, a+b
> ... 
> 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
> 
This one looks pretty good, but you should not have a comma after the
'print b'


> 
> but result is this:
> >>> while b< 10
> SyntaxError: invalid syntax
You need a ':'

> >>> while b < 10:
> ... print b
> IndentationError: expected an indented block (line 2)
Like the error says, you need some indentation after the '...'

> >>> while b < 10:
>        print b
>        a, b = b, a+b ...
>        
> SyntaxError: invalid syntax
What happened to your indent prompt?!?!

> >>> while b < 1000:
> ...     print b,
> IndentationError: expected an indented block (line 2)
Not sure why you got an indentation error, but you should not have the
comma after the 'print b' again.

> >>> while b < 1000:
>   ...  print b,
>   
> SyntaxError: invalid syntax
no comma, again.


Neil Macneale

-- 

If you want to email me, remove the '-devnull' from my email address



More information about the Python-list mailing list