Skip to main content
Course/Module 1/Topic 3 of 4Beginner

Operators & Input

Learn arithmetic operators and how to get input from the user with input().

20 minBy Priygop TeamLast updated: Feb 2026

Python Operators

Python supports all standard arithmetic operators. The // operator does integer (floor) division. The ** operator raises a number to a power. The % operator gives the remainder. Python also has comparison operators (==, !=, >, <) and logical operators (and, or, not).

Operators

  • + — Addition: 5 + 3 = 8
  • - — Subtraction: 10 - 4 = 6
  • * — Multiplication: 3 * 4 = 12
  • / — Division: 10 / 3 = 3.333 (always float)
  • // — Floor division: 10 // 3 = 3 (integer result)
  • % — Modulus (remainder): 10 % 3 = 1
  • ** — Power: 2 ** 8 = 256
  • input() — Gets text input from the user

Operators Example

Example
a = 10
b = 3

print("Addition:", a + b)       # 13
print("Subtraction:", a - b)    # 7
print("Multiplication:", a * b) # 30
print("Division:", a / b)       # 3.333...
print("Floor division:", a // b) # 3
print("Remainder:", a % b)      # 1
print("Power:", a ** 2)         # 100

# Comparison operators
print(10 > 5)    # True
print(10 == 10)  # True
print(10 != 5)   # True

# Logical operators
print(True and False)  # False
print(True or False)   # True
print(not True)        # False

Try It Yourself: Calculator

Try It Yourself: CalculatorPython
Python Editor
✓ ValidTab = 2 spaces
Python|14 lines|399 chars|✓ Valid syntax
UTF-8

Quick Quiz

Chat on WhatsApp
Priygop - Leading Professional Development Platform | Expert Courses & Interview Prep