Coding example apps in Python 2.7 versus Python 3.5

Several readers and students have asked about running the example programs from “Teach Your Kids to Code” in IDLE for Python 2.7 (the common default on Mac OS X and Linux computers) – the good news is that there are two relatively easy options:

Upgrade to Python v3 with the terminal commands:

sudo apt-get install python3

and

sudo apt-get install idle3

(let me know if you’re using a version of Linux that doesn’t work with apt-get, and I’m glad to post a video if it’ll be of help).
All the examples in the book and the online course for “Teach Your Kids to Code” will work as-written for the newer Python/IDLE 3.– OR –

Change just the input() and print() statements in any code examples to raw_input(), and print without the parentheses (the round brackets) for backward compatibility with Python v2.
Example: Here’s what the YourName.py program from Chapter 1, p. 6 of the book, or Lecture 3 of the Udemy course would look like for Python 2.7:

Just a couple of small changes to your apps can help you code in Python 2.7

The other statements (and almost all turtle examples) should work the same from Python 3 back to Python 2, but the input and print statements changed between versions.
I hope this post this is of help, or message me/reply below if you’d like me to post a video – Python 2 is still used widely in the scientific and other communities (and still ships on new Linux/Mac computers). Enjoy either version of Python, and let me know if I can be of help anytime!