Courses/Python Basics

๐Ÿ Python Basics

Arithmetic

Math operators: +, -, *, /, //, %, **

Python is a great calculator. Standard math operators work as expected, plus a few extras:

  • + - * / โ€” the usual
  • // โ€” integer division (drops the remainder)
  • % โ€” modulo (the remainder)
  • ** โ€” exponent
print(7 / 2)    # 3.5
print(7 // 2)   # 3
print(7 % 2)    # 1
print(2 ** 10)  # 1024
main.py
Output
Press Run to execute.
Expected output
78.54

Sign in to track your progress across lessons.