By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,768 Members | 2,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,768 IT Pros & Developers. It's quick & easy.

Why is a None appearing in my output?

P: n/a

I'm a fairly new user of python. I am going through the
tutorial on the website and observed a weird thing
around the 6.0 modules area. (

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
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 ---

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 ...



__________________________________________________ _______________
Getting married? Find tips, tools and the latest trends at MSN Life Events.
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.