O'Reilly logo

Hello World! Second Edition: Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix B. Differences Between Python 2 and 3

Throughout the book, we have mentioned several differences between Python 2 and Python 3. The book uses Python 2, but we also want you to know how to recognize Python 3 code and make your code compatible with Python 3 if you want to. This appendix only talks about the Python 2 to 3 differences in the parts of Python that we have covered in this book. (For example, Python 3 handles Unicode strings differently, but because we didn’t talk about Unicode, we won’t talk about the Python 3 Unicode changes.)

With that in mind, here are some of the ways Python 3 is different from Python 2.

print

In Python 3, print is a function. That means instead of writing

print "Hello, World!"

you need to write

print ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required