[Solved] Python Crash Course : Using int() to accept numerical input


You are using Python 2 and the book author is using Python 3.

In Python 2 input tries to evaluate the entered value, so the string '21' actually becomes 21 as an int.

As @Siddharth pointed out in the comments, str > int will always evaluate to True in Python 2. In Python 3 it will raise the error that is mentioned in the book.

8

solved Python Crash Course : Using int() to accept numerical input