Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Basic Operators | Python Fundamentals lesson | BraveProgrammer
  1. Courses
  2. /
  3. Python Fundamentals

Lesson 5 of 55

·Python

Basic Operators

20 minutes

Course progress9%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • Arithmetic: +, -, *, /, //, %, **.
  • Comparison: ==, !=, >, <, >=, <=.
  • Logical: and, or, not.
  • Operator precedence follows familiar mathematical rules.

Basic Operators

Python provides a rich set of operators for arithmetic, comparison, logical, and assignment operations.

Arithmetic Operators

a = 10
b = 3
print('Add:', a + b)       # 13
print('Sub:', a - b)       # 7
print('Mul:', a * b)       # 30
print('Div:', a / b)       # 3.333...
print('Floor div:', a // b) # 3
print('Mod:', a % b)       # 1
print('Power:', a ** b)   # 1000

Comparison Operators

print('a > b:', a > b)   # True
print('a == b:', a == b) # False

Logical Operators

print('a > 5 and b < 5:', a > 5 and b < 5)   # True
print('a > 5 or b > 5:', a > 5 or b > 5)    # True
print('not (a == b):', not (a == b))        # True

These operators let you build expressions that drive control‑flow and calculations.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Python FundamentalsBrowse activities
Previous lessonVariables and Data TypesContinue to lesson 6Control Flow – If StatementsBack to Python Fundamentals curriculum