Numbers: int, float and complex
Python has int (unlimited size), float and complex numbers. Use // for floor division, % for remainder and ** for powers. round() and abs() are built in.
Example
print(7 // 2, 7 % 2, 2 ** 10)
print(round(3.14159, 2), abs(-5))
print(10 ** 30)
print(complex(1, 2) * 2)Result
3 1 1024 3.14 5 1000000000000000000000000000000 (2+4j)
Exercise
Floor division.
print(7 2)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.