Why is a None appearing in my output?

D

David Stockwell

Hello,

I'm a fairly new user of python. I am going through the
tutorial on the python.org website and observed a weird thing
around the 6.0 modules area. (http://docs.python.org/tut/node8.html)

My python version:
Python 2.2.3 (#1, Feb 26 2004, 14:37:42)
[GCC 3.2 20020903 (Red Hat Linux 8.0 3.2-7)] on linux2


I entered the following text into a 'module file' and saved it:

def fib6(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
else:
print "done b[",b,"], n[",n,"], a[", a,"]"

print "fib6:", fib6(50), "---"
print "next"


I then run it and get the results:
fib6: 1 1 2 3 5 8 13 21 34 done b[ 55 ], n[ 50 ], a[ 34 ]
None ---
next

The question I'm having is what is causing the 'None' to print?
The example tutorial doesn't have the None, but when I run
I am seeing it and I do not see what causes that.

I added the 'else on the while and the "---" stuff to try to figure out what
the None means.

but i have no clue ...

Thanks

David

_________________________________________________________________
Getting married? Find tips, tools and the latest trends at MSN Life Events.
http://lifeevents.msn.com/category.aspx?cid=married
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top