Division in Python

Level 113 keystrokes

This divides 45 by 9 and prints 5.0. In Python, the / operator always returns a float.

Python code

# The / operator performs true division and always returns a float
# So 45 / 9 gives 5.0, not 5, even though it divides evenly
1print(45 / 9)

Output

5.0
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this Python code and how often they appear.

  • (× 1
  • )× 1
  • /× 1

More Python examples at level 1

← Python typing practice