Previous Lecture Complete and continue  

  Caution With Float Declaration

Try the following statement on Python3 prompt:

and then print its value by using either print function or simply typing the variable name on the command prompt

This will print following value on the terminal:

Now, try the same statement on Python 2.7 and/or earlier versions.

You see the output now is 3, indicating that Python performed an integer division. This is because, in 2.7 and earlier versions of Python, any number that you type without a decimal point is treated as integer. In Python 2, the integers are strongly typed. Try the following statement:

It will give the following output indicating the result variable OutputPython is of type integer.