tutorial questions (examples fail).

Gerrit Holl gerrit.holl at pobox.com
Sun Dec 26 12:10:26 EST 1999


Keith White wrote:
> am running 1.5.2
> have printed the tutorial,and got as far as page 17.
> here things go wrong.
> in Defining functions the fibonacci example
> fails both in interactive mode and if created as a script
> with such things as
> 
> myfish at peche:~ > python
> Python 1.5.2 (#3, Dec 26 1999, 13:32:19)  [GCC egcs-2.91.66 19990314
> (egcs-1.1.2  on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> def fib(n): # write Fibonacci series up to n
> ... "Print a Fibonacci series up to n"
>   File "<stdin>", line 2
>     "Print a Fibonacci series up to n"

Python blocks are based on indentation. Try:
>>> def fib(n): # write Fibonacci series up to n
...     "print a Fibonacci series up to n"
...     # your code here

regards,
Gerrit.

-- 
"The world is beating a path to our door"

  -- Bruce Perens, (Open Sources, 1999 O'Reilly and Associates)
  5:33pm  up  7:04, 16 users,  load average: 0.09, 0.03, 0.01




More information about the Python-list mailing list