Day 2

Operators & Boolean Logic

Programmer’s Picnic – AI / ML Internship Track

The Boolean Type in Python

Python has a special data type called bool.

True False

👉 Every condition in Python finally becomes True or False.

Booleans from Comparisons

print(10 > 5) # True print(10 < 5) # False print(10 == 10) # True print(10 <= 9) # False

Comparison operators always return a Boolean value.

Interactive: Arithmetic Operators

Choose numbers:



Interactive: Comparison Operators

Compare:



Logical Operators

Logical operators combine Boolean values.

and → both must be True or → any one True not → reverses the value True and False → False True or False → True not True → False

Interactive: Logical Operators

Select Boolean values:

A: B:

Why Boolean Logic Matters

Day 2 Summary