07/26/2025
Operators in
Python
B.Hemalatha
Assistant Professor ,
Department of Computer Science
Engineering,
Velammal Engineering College.
VELAMMAL ENGINEERING COLLEGE
An Autonomous Institution, Affiliated to Anna University, Chennai
Accredited by NAAC & NBA
1
07/26/2025
Recap
 Introduction to Python
 Features of Python
 Why Python
 Python Setup and Fundamentals
 Values and Variables
 Keywords and Data Types
2
07/26/2025 3
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
1. Introduction to Python
• Python - general-purpose language.
• High level programming language.
• It was created by Guido Van Rossum in 1991.
• Further developed by the Python Software
Foundation.
• It is used to develop web applications, data
science, creating software prototypes and
etc.
07/26/2025 4
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
2. Features of Python  Interactive: Write a program directly on the Python
prompt
 Interact directly with the interpreter and get the
immediate results.
 Extensible Feature
 Integrate Python with other languages such as
C, C++, and Java.
 Python has a large and extensive library
 wide set of functions for rapid application
development.
 Dynamically Typed: Means the type for a value is
decided at runtime.
 Not necessary to specify the type of data when
declaring it
 GUI Programming Support
 provides many graphical user interface (GUI)
libraries PyQT5, Tkinter
07/26/2025 5
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
07/26/2025 6
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
07/26/2025 7
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
4. Python Setup and Fundamentals
07/26/2025 8
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
4. Python using IDLE
Download the Python 3 Installer at python.org.
07/26/2025 9
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
4. Python- IDLE
Interactive mode Script mode
07/26/2025 10
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
4. Python Using Jupyter Notebook
Installing Jupyter Notebook using Anaconda Navigator
07/26/2025 11
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
5. Values and Variables
• Variables are containers for storing data values.
Syntax:
Variable_name = Value (value belongs to any
datatype)
Example
x = 5
y = ”John”
print(x)
print(y)
07/26/2025 12
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
5. Values and Variables - examples
1. Age = 99
2. Name = ‘Rajesh’ or “Rajesh”
3. Pi_Value = 3.14
4. Greeting = ‘Good Morning’
5. Rs=200
Note: = is called as Assignment Operator
07/26/2025 13
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
5. Values and Variables
Python allows you to assign values to multiple variables in one line:
Example :
x, y, z = "Orange", "Banana", "Cherry"
print(x)
print(y)
print(z)
Assign the same value to multiple variables in one line:
Example
x = y = z = "Orange"
print(x)
print(y)
print(z)
07/26/2025 14
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
6. Data Types
 A data type defines the type of data and allows languages to organize
different kinds of data
 Eg.123 is an integer data while “hello” is a String data type
07/26/2025 15
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
6. Data Types
07/26/2025 16
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
6. Data Types
The data types in Python are divided in two categories:
1. Immutable data types – Values cannot be changed.
2. Mutable data types – Values can be changed
Immutable data types Mutable data types
1.Numbers
2. String
3. Tuple
4. Bool
5. List
6. Dictionaries
7. Set
Examples in Jupyter Notebook
07/26/2025 17
Indexing of sequences
07/26/2025 18
Velammal Engineering College
(An Autonomous Institution, Affiliated to Anna University, Chennai)
(Accredited by NAAC & NBA)
6. Keywords
 Keywords are the reserved words in Python.
 Cannot use a keyword as a variable name, function name or
any other identifier.
 Keywords are case sensitive.
Poll 1 - Recap
OPERATORS
Why
 Manipulate
individual items
and return
Result
 Control program
flow
Benefits
Understanding
and usage of
Operators
helps for
writing efficient code
What are Operators?
Symbols that perform an operation on
one or more operands.
OPERATORS
Operator Types
1. Arithmetic Operators
2. Comparison (Relational)
Operators
3. Assignment Operators
4. Logical Operators
5. Unary Operator
6. Bitwise Operators
7. Membership Operators
8. Identity Operators
Mathematical operators
Compare values
Right operand assigned to the
left operand
Combine conditional
statements
perform operations on a
single operand
bit by bit operation
test whether a value or a
variable is found in a
sequence
Compare object based on
memory location
+ - * / // %
== != < > >= <=
= += -= *= /= //= %=
and or not xor
-
& | ~ ^ >> <<
in not in
is is not
Arithmetic Operators
Basic Operators
+
-
*
/
%
//
**
Examples
x = 5
print(x+3)
8
What ?
Perform arithmetic operations between two
numeric operands
Add
Subtract
Multiply
Divide
Modulus
Floor-division
Exponentiation
x = 12
print(x-2)
10
x = 21
print(x/2)
10.5
x = 21
print(x//4)
5
x = 2
print(x**3)
8
07/26/2025
ARITHMETIC OPERATORS
❑Arithmetic operators are used to perform arithmetic operations between
two operands.
22
Using Operators with Strings
Python supports concatenating strings using the
addition operator:
Python Script
OUTPUT
Welcome to Python Bridge Course
s1=“Welcome to "
s2=“Python Bridge Course"
concat= s1+s2
print(concat)
23
Using Operators with Strings
Python also supports multiplying strings to form a
string with a repeating sequence:
Python Script
OUTPUT
repeat repeat repeat
s = "repeat " * 3
print(s)
24
Using Operators with Lists
Lists can be joined with the addition operators:
Python Script
OUTPUT
[1, 3, 5, 7, 2, 4, 6, 8]
even_numbers = [2,4,6,8]
odd_numbers = [1,3,5,7]
all_numbers = odd_numbers + even_numbers
print(all_numbers)
25
Using Operators with Lists
Python supports forming new lists with a repeating
sequence using the multiplication operator:
Python Statement
OUTPUT
[1, 2, 3, 1, 2, 3, 1, 2, 3]
print([1,2,3] * 3)
26
Assignment Operators
Basic Operators
=
+ =
- =
* =
/ =
% =
// =
** =
Examples
x = 5
x + = 3
#x=x+3
print(x)
8
Use Cases
 Short hand
expressions
 Assigning values
to variables
 Modifying
variable values
Benefits
 Improved readability
 Reduced repetition.
Assign
Add and Assign
Subtract and Assign
Multiply and Assign
Divide and Assign
Modulus and Assign
Floor-divide and Assign
Exponentiation and Assign
x = 12
x - = 2
print(x)
10
x = 21
x / = 4
print(x)
5.25
x = 21
x // = 4
print(x)
5
x = 2
x ** = 3
print(x)
8
07/26/2025
COMPARISON (RELATIONAL)
OPERATORS
❑Comparison operators are used to comparing the value of the two operands
and returns Boolean True or False accordingly.
28
Logical operators
Basic Operators
and
or
not
Examples
x,y = 10,10
print(x>y and x==y)
False
print(x>y or x==y)
True
print(x>=y and x==y)
True
Use Cases
Combine multiple
conditions
Benefits
 control the
flow of program execution
based on multiple
conditions.
 Evaluate to make
decisions
Logical AND :
True if both
operands are
True
Logical OR : True if
at least one operand
is True
Logical NOT :
Reverses the boolean
state of the operand
x,y=10,20
print(not(x>y))
True
29
Poll 2
30
Membership Operators
What
• Test whether a value is present
in a sequence, such as a list or a
string
Operators
• in
• not in
Returns
• Boolean value True if value
present in the sequence.
• Boolean value True if value
present in the sequence.
x={"python","java","c
language","php","vb"}
print("java" in x)
print(“php” not in x)
Output
True
Fa;se
07/26/2025
IDENTITY OPERATORS
❖Identity operators compare the memory locations of two objects.
31
07/26/2025
PROGRAM OUTPUT
x,y,z=15,15,10
print(x is y)
print(x is z)
print(y is z)
print(x is not y)
print(x is not z)
x,y,z=[1,2,3,4,5], [1,2,3,4,5], [6,7,8,9]
print(x is y)
print(x is z)
print(y is z)
print(x is not y)
print(x is not z)
True
False
False
False
True
False
False
False
True
True
32
07/26/2025
UNARY OPERATOR
❑The unary operators require only one operand; they perform
various operations, negating an expression, or inverting the
value of a boolean.
❑unary - (minus) operator yields the negation of its numeric
argument
❑The unary ~ (invert) operator yields the bitwise inversion of its
integer argument. The bitwise inversion of x is defined as -
(x+1). It only applies to integral numbers.
33
07/26/2025
BITWISE OPERATORS
❑The bitwise operators perform bit by bit operation on the values of the two
operands.
Eg:
if a = 7
b = 6
then,
binary (a) = 0111
binary (b) = 0011
hence, a & b = 0011
a | b = 0111
a ^ b = 0100
~ a = 1000
34
07/26/2025
BITWISE AND ( &)
35
07/26/2025
BITWISE OR ( | )
36
07/26/2025
BITWISE XOR ( ^ )
37
07/26/2025
BITWISE NOT (~)
38
07/26/2025
Bitwise Shift Operators - Left Shift ( <<)
39
07/26/2025
Bitwise Shift Operators - Right Shift ( >>)
40
41
Precedence and Associativity
 Determines the order in which they
are evaluated.
 The precedence of operators
determines which operation is
performed first in an expression.
 The associativity of operators
determines the order in which
operations are performed when
multiple operators of the same
precedence are present.
07/26/2025
PROGRAMS TO ILLUSTRATE PRECEDENCE
AND ASSOCIATIVITY
p= 20
q=10
r=15
s=5
t=0
t=(p+q)*r / s
print (“Value of t”,t)
t=(p+q)* (r / s)
print (“Value of t”,t)
print ((2**4)**2)
OUTPUT
90
90
256
42
07/26/2025
Evaluate each expression
a) 4 / 10 + 3 * 2 ---
b) 4 % 10 + 6 // 5 ---
c) abs(4-20//3) ** 3 ---
6.4
5
8
43
Poll 3
07/26/2025
ILLUSTRATIVE PROGRAMS - SIMPLE
ARITHMETIC PROGRAMS
1. Write a program to find average of two numbers in python
2. Write a program to convert temperature from Fahrenheit to Celsius
4. Write a program to find area of circle
5. Write a program to find the distance of two points
6. Write a Python program to accept two numbers, compute the sum, product and print the
result.
7. Write a Python program to accept two numbers, find the greatest and print the result.
8. Write a Python program to exchange the value of two variables
9. Write a Python program to perform addition, subtraction, division, multiplication on two
floating point numbers.
44
07/26/2025 45
Go to college
Learn
Leave from college
Any
pocket
money
left?
Buy an ice-cream
Return home
YES
NO
07/26/2025 46
Go to college
Learn
Leave from college
Any
pocket
money
left?
Buy an ice-cream
Return home
YES
NO
07/26/2025 47
Get ready for shopping
Raining
heavily
?
wear raincoat
Go to shop
YES
NO
Take umbrella
Is it
raining
?
YES
NO
Wear a cap
07/26/2025 48
Get ready for shopping
Rainy
day?
Wear sweatshirt
Wear Coat
YES
NO
Wear raincoat
Sunny
day?
snowy
day?
windy
day?
NO
NO
Wear Cap
Wear t-shirt Go to shop
YES
YES
YES
NO
07/26/2025 49

9.8.24_operators........................

  • 1.
    07/26/2025 Operators in Python B.Hemalatha Assistant Professor, Department of Computer Science Engineering, Velammal Engineering College. VELAMMAL ENGINEERING COLLEGE An Autonomous Institution, Affiliated to Anna University, Chennai Accredited by NAAC & NBA 1
  • 2.
    07/26/2025 Recap  Introduction toPython  Features of Python  Why Python  Python Setup and Fundamentals  Values and Variables  Keywords and Data Types 2
  • 3.
    07/26/2025 3 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 1. Introduction to Python • Python - general-purpose language. • High level programming language. • It was created by Guido Van Rossum in 1991. • Further developed by the Python Software Foundation. • It is used to develop web applications, data science, creating software prototypes and etc.
  • 4.
    07/26/2025 4 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 2. Features of Python  Interactive: Write a program directly on the Python prompt  Interact directly with the interpreter and get the immediate results.  Extensible Feature  Integrate Python with other languages such as C, C++, and Java.  Python has a large and extensive library  wide set of functions for rapid application development.  Dynamically Typed: Means the type for a value is decided at runtime.  Not necessary to specify the type of data when declaring it  GUI Programming Support  provides many graphical user interface (GUI) libraries PyQT5, Tkinter
  • 5.
    07/26/2025 5 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA)
  • 6.
    07/26/2025 6 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA)
  • 7.
    07/26/2025 7 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 4. Python Setup and Fundamentals
  • 8.
    07/26/2025 8 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 4. Python using IDLE Download the Python 3 Installer at python.org.
  • 9.
    07/26/2025 9 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 4. Python- IDLE Interactive mode Script mode
  • 10.
    07/26/2025 10 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 4. Python Using Jupyter Notebook Installing Jupyter Notebook using Anaconda Navigator
  • 11.
    07/26/2025 11 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 5. Values and Variables • Variables are containers for storing data values. Syntax: Variable_name = Value (value belongs to any datatype) Example x = 5 y = ”John” print(x) print(y)
  • 12.
    07/26/2025 12 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 5. Values and Variables - examples 1. Age = 99 2. Name = ‘Rajesh’ or “Rajesh” 3. Pi_Value = 3.14 4. Greeting = ‘Good Morning’ 5. Rs=200 Note: = is called as Assignment Operator
  • 13.
    07/26/2025 13 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 5. Values and Variables Python allows you to assign values to multiple variables in one line: Example : x, y, z = "Orange", "Banana", "Cherry" print(x) print(y) print(z) Assign the same value to multiple variables in one line: Example x = y = z = "Orange" print(x) print(y) print(z)
  • 14.
    07/26/2025 14 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 6. Data Types  A data type defines the type of data and allows languages to organize different kinds of data  Eg.123 is an integer data while “hello” is a String data type
  • 15.
    07/26/2025 15 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 6. Data Types
  • 16.
    07/26/2025 16 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 6. Data Types The data types in Python are divided in two categories: 1. Immutable data types – Values cannot be changed. 2. Mutable data types – Values can be changed Immutable data types Mutable data types 1.Numbers 2. String 3. Tuple 4. Bool 5. List 6. Dictionaries 7. Set Examples in Jupyter Notebook
  • 17.
  • 18.
    07/26/2025 18 Velammal EngineeringCollege (An Autonomous Institution, Affiliated to Anna University, Chennai) (Accredited by NAAC & NBA) 6. Keywords  Keywords are the reserved words in Python.  Cannot use a keyword as a variable name, function name or any other identifier.  Keywords are case sensitive. Poll 1 - Recap
  • 19.
    OPERATORS Why  Manipulate individual items andreturn Result  Control program flow Benefits Understanding and usage of Operators helps for writing efficient code What are Operators? Symbols that perform an operation on one or more operands.
  • 20.
    OPERATORS Operator Types 1. ArithmeticOperators 2. Comparison (Relational) Operators 3. Assignment Operators 4. Logical Operators 5. Unary Operator 6. Bitwise Operators 7. Membership Operators 8. Identity Operators Mathematical operators Compare values Right operand assigned to the left operand Combine conditional statements perform operations on a single operand bit by bit operation test whether a value or a variable is found in a sequence Compare object based on memory location + - * / // % == != < > >= <= = += -= *= /= //= %= and or not xor - & | ~ ^ >> << in not in is is not
  • 21.
    Arithmetic Operators Basic Operators + - * / % // ** Examples x= 5 print(x+3) 8 What ? Perform arithmetic operations between two numeric operands Add Subtract Multiply Divide Modulus Floor-division Exponentiation x = 12 print(x-2) 10 x = 21 print(x/2) 10.5 x = 21 print(x//4) 5 x = 2 print(x**3) 8
  • 22.
    07/26/2025 ARITHMETIC OPERATORS ❑Arithmetic operatorsare used to perform arithmetic operations between two operands. 22
  • 23.
    Using Operators withStrings Python supports concatenating strings using the addition operator: Python Script OUTPUT Welcome to Python Bridge Course s1=“Welcome to " s2=“Python Bridge Course" concat= s1+s2 print(concat) 23
  • 24.
    Using Operators withStrings Python also supports multiplying strings to form a string with a repeating sequence: Python Script OUTPUT repeat repeat repeat s = "repeat " * 3 print(s) 24
  • 25.
    Using Operators withLists Lists can be joined with the addition operators: Python Script OUTPUT [1, 3, 5, 7, 2, 4, 6, 8] even_numbers = [2,4,6,8] odd_numbers = [1,3,5,7] all_numbers = odd_numbers + even_numbers print(all_numbers) 25
  • 26.
    Using Operators withLists Python supports forming new lists with a repeating sequence using the multiplication operator: Python Statement OUTPUT [1, 2, 3, 1, 2, 3, 1, 2, 3] print([1,2,3] * 3) 26
  • 27.
    Assignment Operators Basic Operators = += - = * = / = % = // = ** = Examples x = 5 x + = 3 #x=x+3 print(x) 8 Use Cases  Short hand expressions  Assigning values to variables  Modifying variable values Benefits  Improved readability  Reduced repetition. Assign Add and Assign Subtract and Assign Multiply and Assign Divide and Assign Modulus and Assign Floor-divide and Assign Exponentiation and Assign x = 12 x - = 2 print(x) 10 x = 21 x / = 4 print(x) 5.25 x = 21 x // = 4 print(x) 5 x = 2 x ** = 3 print(x) 8
  • 28.
    07/26/2025 COMPARISON (RELATIONAL) OPERATORS ❑Comparison operatorsare used to comparing the value of the two operands and returns Boolean True or False accordingly. 28
  • 29.
    Logical operators Basic Operators and or not Examples x,y= 10,10 print(x>y and x==y) False print(x>y or x==y) True print(x>=y and x==y) True Use Cases Combine multiple conditions Benefits  control the flow of program execution based on multiple conditions.  Evaluate to make decisions Logical AND : True if both operands are True Logical OR : True if at least one operand is True Logical NOT : Reverses the boolean state of the operand x,y=10,20 print(not(x>y)) True 29 Poll 2
  • 30.
    30 Membership Operators What • Testwhether a value is present in a sequence, such as a list or a string Operators • in • not in Returns • Boolean value True if value present in the sequence. • Boolean value True if value present in the sequence. x={"python","java","c language","php","vb"} print("java" in x) print(“php” not in x) Output True Fa;se
  • 31.
    07/26/2025 IDENTITY OPERATORS ❖Identity operatorscompare the memory locations of two objects. 31
  • 32.
    07/26/2025 PROGRAM OUTPUT x,y,z=15,15,10 print(x isy) print(x is z) print(y is z) print(x is not y) print(x is not z) x,y,z=[1,2,3,4,5], [1,2,3,4,5], [6,7,8,9] print(x is y) print(x is z) print(y is z) print(x is not y) print(x is not z) True False False False True False False False True True 32
  • 33.
    07/26/2025 UNARY OPERATOR ❑The unaryoperators require only one operand; they perform various operations, negating an expression, or inverting the value of a boolean. ❑unary - (minus) operator yields the negation of its numeric argument ❑The unary ~ (invert) operator yields the bitwise inversion of its integer argument. The bitwise inversion of x is defined as - (x+1). It only applies to integral numbers. 33
  • 34.
    07/26/2025 BITWISE OPERATORS ❑The bitwiseoperators perform bit by bit operation on the values of the two operands. Eg: if a = 7 b = 6 then, binary (a) = 0111 binary (b) = 0011 hence, a & b = 0011 a | b = 0111 a ^ b = 0100 ~ a = 1000 34
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
    07/26/2025 Bitwise Shift Operators- Right Shift ( >>) 40
  • 41.
    41 Precedence and Associativity Determines the order in which they are evaluated.  The precedence of operators determines which operation is performed first in an expression.  The associativity of operators determines the order in which operations are performed when multiple operators of the same precedence are present.
  • 42.
    07/26/2025 PROGRAMS TO ILLUSTRATEPRECEDENCE AND ASSOCIATIVITY p= 20 q=10 r=15 s=5 t=0 t=(p+q)*r / s print (“Value of t”,t) t=(p+q)* (r / s) print (“Value of t”,t) print ((2**4)**2) OUTPUT 90 90 256 42
  • 43.
    07/26/2025 Evaluate each expression a)4 / 10 + 3 * 2 --- b) 4 % 10 + 6 // 5 --- c) abs(4-20//3) ** 3 --- 6.4 5 8 43 Poll 3
  • 44.
    07/26/2025 ILLUSTRATIVE PROGRAMS -SIMPLE ARITHMETIC PROGRAMS 1. Write a program to find average of two numbers in python 2. Write a program to convert temperature from Fahrenheit to Celsius 4. Write a program to find area of circle 5. Write a program to find the distance of two points 6. Write a Python program to accept two numbers, compute the sum, product and print the result. 7. Write a Python program to accept two numbers, find the greatest and print the result. 8. Write a Python program to exchange the value of two variables 9. Write a Python program to perform addition, subtraction, division, multiplication on two floating point numbers. 44
  • 45.
    07/26/2025 45 Go tocollege Learn Leave from college Any pocket money left? Buy an ice-cream Return home YES NO
  • 46.
    07/26/2025 46 Go tocollege Learn Leave from college Any pocket money left? Buy an ice-cream Return home YES NO
  • 47.
    07/26/2025 47 Get readyfor shopping Raining heavily ? wear raincoat Go to shop YES NO Take umbrella Is it raining ? YES NO Wear a cap
  • 48.
    07/26/2025 48 Get readyfor shopping Rainy day? Wear sweatshirt Wear Coat YES NO Wear raincoat Sunny day? snowy day? windy day? NO NO Wear Cap Wear t-shirt Go to shop YES YES YES NO
  • 49.

Editor's Notes

  • #30 Image source: https://smallcode.org/python-tutorials/operator-in-python
  • #41 Image source: https://techvidvan.com/tutorials/python-operators/