Skip to content

Latest commit

 

History

History
74 lines (52 loc) · 2.91 KB

File metadata and controls

74 lines (52 loc) · 2.91 KB

⚙️ 04_Operators

Welcome to the Operators in Python section! Operators are special symbols or keywords that perform operations on variables and values. In this section, you’ll explore different types of operators in Python that form the foundation of all logical, mathematical, and conditional expressions.


🧭 Folder Structure

04_Operators/
│
├── 01_arithmetic_operators.py
├── 02_assignment_operators.py
├── 03_comparison_operators.py
├── 04_logical_operators.py
├── 05_truth_tables.py
└── README.md

📘 Overview

You’ll learn:

  • How arithmetic operators handle basic mathematical calculations.
  • How assignment operators combine variable updates with operations.
  • How comparison operators evaluate relationships between values.
  • How logical operators connect multiple conditions in decision-making.
  • The concept of truth tables for understanding and, or, and not results.

🧩 Files Description

File Name Description
01_arithmetic_operators.py Demonstrates basic arithmetic operations like +, -, *, /, //, %, and **.
02_assignment_operators.py Shows how operators like +=, -=, *=, and /= simplify variable updates.
03_comparison_operators.py Explains operators such as ==, !=, >, <, >=, and <= used for comparing values.
04_logical_operators.py Covers logical operators — and, or, and not — and how they connect multiple conditions.
05_truth_tables.py Visualizes truth tables for logical operators to understand how different combinations yield True or False.

🎯 Learning Goals

By the end of this section, you’ll be able to:

  • Perform mathematical and logical operations confidently.
  • Combine operations using compound assignment for cleaner code.
  • Compare values and make decisions using conditions.
  • Understand how logical operators work internally through truth tables.
  • Build expressions that form the core of conditionals and loops.

💡 Practice Ideas

Try out these small projects:

  • Build a calculator that performs basic arithmetic operations.
  • Create a program that compares two numbers and prints which one is larger.
  • Write a script to check if a given number lies between two values using logical operators.
  • Generate and print truth tables for all logical combinations.
  • Combine arithmetic and assignment operators in a single expression for practice.

Next Section → 05_Conditionals_Loops