Skip to main content
Python 2 vs. Python 3

A look at the differences between Python 2 and Python 3 within the CodeHS curriculum

Jeremy Keeshin avatar
Written by Jeremy Keeshin
Updated over 6 months ago

The newest version of our Introduction to Python course teaches students the basics using Python 3, instead of Python 2.

After the 2020-21 school year, we updated all videos, quizzes, examples, and exercises to teach and run Python 3, so you can teach your students the most up-to-date version of the language. You can learn more about our Python curriculum in this article, or in our course catalog.

Please note: the Python 2 version of this course was available until the end of the 2019-20 school year for students.

What are the differences between Python 2 and Python 3?

Within the CodeHS curriculum, the differences between Python 2 and 3 are minimal:

  1. Print is now called as a function, with parentheses: (print('hello')) 

  2. Division now returns a float by default. You can make it behave like Python 2 with // (i.e. 1 // 2) 

  3. xrange  no longer exists, so you can just use range

  4. dict.iteritems()  is now dict.items() 


Still have questions? Contact our team at hello@codehs.com to learn more!

Did this answer your question?