Beginner Codes/Python/Logical Operators
13%

Instructions

Syntax

condition1 and condition2

Logical Operators (and, or, not) 🧠

Oru condition-a check panna if use panrom. Aana rendu moonu condition-a orey nerathula check pannanum na? Adhuku dhaan Logical Operators varudhu!

The Three Main Operators

OperatorMeaningNamba Basha (Tanglish)
andRendu pakkamum True aaganum."Idhuvum venum, Adhuvum venum!"
orEdhavadhu onnu True aana podhum."Idhu illana Adhu paravala!"
notIrukardha apdiye reverse pannum."True na False, False na True!"

Examples

1. and (Strict Security Guard 👮‍♂️)

Movie ku poga Ticket-um venum, 18 vayasu mela irukkanum. Rendum irundha dhaan ulla viduvanga!

age = 20
has_ticket = True

if age >= 18 and has_ticket:
    print("Padathuku ulla polam!")
else:
    print("Veliye nillu thambi!")

2. or (Chill Security Guard 😎)

Biriyani vanga Aadhar card illana Voter ID, edhavadhu onnu irundha podhum.

has_aadhar = False
has_voter_id = True

if has_aadhar or has_voter_id:
    print("Innaikaikku Biriyani dhaan!")

3. not (Opposite aalu 🔄)

Mazhai peyyala na veliya povom. is_raining oda opposite-a check panna not use panrom.

is_raining = False

if not is_raining:
    print("Veliya polam, jolly-a!")

🔍 Deep Dive: Truth Tables (Nijamum Poiyum)

Python eppadi idha yosikkudhu nu innum deeply paakalama? Idhuku peru "Truth Table". Rendu values vachi check pannum podhu ena mudivu varum nu paapom.

and (Rendum venum):

  • True and True ➡️ True (Rendum ok, allowed!)
  • True and False ➡️ False (Onnu miss aagiduchu, so NOT allowed!)
  • False and False ➡️ False (Rendume illa, veliya po!)

or (Edhachu onnu podhum):

  • True or False ➡️ True (Onnu ok-na kooda allowed!)
  • False or True ➡️ True (Edho onnu irukku, so allowed!)
  • False or False ➡️ False (Rendume illana dhaan fail aagum!)

not (Strict-a Opposite):

  • not True ➡️ False
  • not False ➡️ True

Idha theliva purinjikka indha interactive Logic Gate-a try pannunga:

Interactive Logic Gates

Operator Selection
TrueandFalse
(True/False value-a click panna maathikkalam)
Output Result
Result is:
FALSE
AND watchman mudiyadhu nu solraru! Rendu pakkamum True-a irukkanum! 🚫

💡 Did You Know? Matha programming languages-la and-ku && poduvanga, or-ku || poduvanga. Aana Python-la romba simple-a English word dhaan (and, or, not) use pannuvanga!

Your Turn! (Unga neram!)

Oru variable is_sunny create panni True nu set pannunga. Innoru variable is_weekend create panni True nu set pannunga. Rendum True aana, "Go to the beach!" nu print pannanum.

Help

Logical OperatorsExercise 11/7720 XP
❴❵ script.py
python.code
python
Loading...
Terminal
Terminal — python
Beginner Codes Terminal v1.0.0
─────────────────────────────────────
Ready. Click "Run Code" to execute...
Ready
Piston APIPYTHON0 lines