[Tutor] Use of Python 3 on a Mac

Alan Gauld alan.gauld at yahoo.co.uk
Sun Feb 27 19:49:02 EST 2022


On 27/02/2022 20:53, André FOURNERAT wrote:

> I use a Mac under OS 10.11.6.
> I have downloaded Python
> I use a book in French « Apprendre à programmer avec Python 3 » (Learning to program with Python 3).
> one of the first exercises should read this
>>>> a=20
>>>> if (a>100):
> …		print (« a is more than a hundred »)
> …	else:
> …		print (« a is less than a hundred »)
>
I'm guessing the French book uses << >>  as quotes
but your locale uses something different.
Use whatever quote symbols are correct in your locale.

> but the result is this with Python 3.9.0
> 
> and it is this with Python 3.10.2

Unfortunately this is a text only mailing list(for
security and compatibility reasons) so your (presumably)
screenshots got stripped by the server. Please post
all output using plain text only.

Assuming you have a Mac version of python installed
then 3.9 at least should work just fine. 3.10 may
well do too.

Finally, in the line

if (a>100):

The brackets are not needed in Python.

if a>100:

would be the normal way to write it.

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