[Tutor] python tutorial issue

Ross Wilson rzzzwilson at gmail.com
Sun Oct 18 20:29:01 EDT 2020


On 18/10/2563 BE 22:42, Christopher Loy wrote:
> def fib(n):  # write Fibonacci series up to n
> 	“””Print a Fibonacci series up to n.”””
> 	a, b= 0, 1
> 	while a <  n:
> 		print(a, end=‘ ‘)

Assuming that all the funny characters in your post were NOT in your code...

You appear to be using python 2 which is the standard python that is 
installed on a Mac.  You can check this by executing this in your terminal:

     python -V

If you want to run python 3 you need to install it.  Go to python.org 
and select "Downloads" from the menu bar and install the PKG file.  Then 
you need to use "python3" on the command line to actually execute 
python3.  Do this to check the version of the new python:

     python3 -V



More information about the Tutor mailing list