Examples
Example 1: Checking Multiple Conditions
age_nihar = 30
age_harsha = 28
age_check = (age_nihar > 25) and (age_harsha > 25)
print(f"Are both Dodagatta Nihar and Harsha older than 25? {age_check}")
Output:
Are both Dodagatta Nihar and Harsha older than 25? True
Example 2: Checking One of Two Conditions
has_internet = True
has_power = False
can_work_remotely = has_internet or has_power
print(f"Can Praveen work remotely? {can_work_remotely}")
Output:
Can Praveen work remotely? True
Example 3: Using NOT Operator
is_tired = True
can_go_for_a_walk = not is_tired
print(f"Can Vasanta Kumar go for a walk? {can_go_for_a_walk}")
Output:
Can Vasanta Kumar go for a walk? False