Exercises target Python 2.7 only?

232 views
Skip to first unread message

Paul R

unread,
Nov 24, 2014, 8:24:34 AM11/24/14
to python-g...@googlegroups.com
I am new to the Google python exercises.  I was trying to get started up with them and the first thing I did (run the hello.py script) failed.  It appears that it was written for 2.7, doesn't work under Python 3.2 and I didn't see any obvious note to that effect.

(The specific problem with that script is paren's missing on print call.)

Tasya Aditya Rukmana

unread,
Nov 24, 2014, 10:58:34 AM11/24/14
to python-g...@googlegroups.com

There are differences between python 2.7.x and 3.x in terms of syntax, etc. So yeah, the exercises are written in python 2.7 and runs optimally on that version (I'm not sure if it'll compile successfully on Python 2.6 or lower). But maybe if you want some more challenge maybe you can try changing the code to match that of python 3 syntax and then compile it.

Best of luck!

On Nov 24, 2014 8:24 PM, "Paul R" <pro...@gmail.com> wrote:
I am new to the Google python exercises.  I was trying to get started up with them and the first thing I did (run the hello.py script) failed.  It appears that it was written for 2.7, doesn't work under Python 3.2 and I didn't see any obvious note to that effect.

(The specific problem with that script is paren's missing on print call.)

--
You received this message because you are subscribed to the Google Groups "Python GCU Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-gcu-for...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Paul R

unread,
Nov 24, 2014, 5:40:46 PM11/24/14
to python-g...@googlegroups.com
It's not a challenge to make hello.py run under Python 3.x - as I pointed out in my original message the problem is simply that the print call is missing its parens.  I did verify that fixing that made the script run fine before I posted my original message.

The peculiar thing to me was that Python 3.x has been around for 5 years now, so it wouldn't make much sense to me that someone learning Python now would want to learn 2.7 rather than 3.2 and yet the script that is provided here to "test your installation is correct" won't run under a python less than 5 years old!

Why?

Tasya Aditya Rukmana

unread,
Nov 24, 2014, 6:32:43 PM11/24/14
to python-g...@googlegroups.com

Oh I see, from what I read at many sites and books the thing is that most of python app out there still uses python 2.7 and therefore tutorials tend to teach python in the 2.7 version, I also vaguely remember a person stating that some modules are not compatible with python 3 and so on... So yeah, I think that's the reason (at least partially).

Kieran Maharaj

unread,
Dec 4, 2014, 1:30:59 PM12/4/14
to python-g...@googlegroups.com


On Monday, 24 November 2014 13:24:34 UTC, Paul R wrote:
I am new to the Google python exercises.  I was trying to get started up with them and the first thing I did (run the hello.py script) failed.  It appears that it was written for 2.7, doesn't work under Python 3.2 and I didn't see any obvious note to that effect.

(The specific problem with that script is paren's missing on print call.)
 
The other big difference is
raw_input(question)
changed to
input(question)

Most people forget this one (nearly all of the other differences are behind the scenes. 
Reply all
Reply to author
Forward
0 new messages