[Tutor] compile problem in emacs

vissen at gmx.net vissen at gmx.net
Fri Feb 20 13:32:42 EST 2004

> > i am learning python and use Emacs as the editor (i am new to linux
> > also) to compile a simple program to generate fibonacci numbers from the
> > example given in the tutorial by Guido Rossum and it gave a syntax
> > error.  This example is included as part of documentation in redhat
> > linux version 8 .  any suggestions / ideas are useful. thanks for
> > reading.
> If it's a SyntaxError, we really need to look closely at what you've typed
> in, as well as what Python is complaining about.  The problem here is that
> there are many different ways a SyntaxError can occur! We don't want to
> enumerate them all, because you'll get bored, and it won't help.  *grin*
> So let's try not guess the problem: show us what you typed, and we can
> start from there.

this is the code i saved in the emacs ed file ...

def fib(n):    # write Fibonacci series up to n
"""Print a Fibonacci series up to n."""
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b

and then in terminal mode i typed :

$ python prgm22.py

which generates the syntax error in the line1 ( def fib(n):  ). have i made
any mistake ? thanks for the reply.


GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...)
jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++

More information about the Tutor mailing list