[Tutor] python tutorial issue

Alan Gauld alan.gauld at yahoo.co.uk
Sun Oct 18 15:20:23 EDT 2020


On 18/10/2020 16:42, Christopher Loy wrote:
> I’m currently on mac with python running python in terminal going through the tutorial off of the website python.org.   https://docs.python.org/3/tutorial/controlflow.html  on the control flow of the python part 4.6 doing the example every time I try to do the example on python part of the terminal I’m getting a Syntaxerror:  invalid syntax  on the  equals sign on print on line 5 of the code.  I could not figure out the issue trying different ways of typing but i have it typed as so
> 
> 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=‘ ‘)

I think the problem is the quote signs. They are not the
regular ASCII versions but the fancy kind you use in a
word processor.

What are you using to type the code? Is it a simple text
editor or a word processor? It should be the former
for programming - well, not necessarily simple but
a plain text editor at least!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list