Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Python Operator For Presentation Seminar

Uploaded by

files.skiruthik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Python Operator For Presentation Seminar

Uploaded by

files.skiruthik
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Understanding Python Operator

A Comprehensive Guide
PRESENTED BY
SARAN KIRUTHIK S S
11-08-2024
Introduction
• What are Python Operators?

• Operators are special symbols that perform operations on variables


and values.Importance: They form the backbone of Python expressions,
enabling everything from basic arithmetic to complex data
manipulation.
Types of Operators
• Overview of Python
• Arithmetic Operators
• Comparison (Relational) Operators
• Logical Operators
• Bitwise Operators
• Assignment Operators
• Identity Operators
• Membership Operators
a = 10
Arithmetic Operators
b=3 • + : Addition
• - : Subtraction
• * : Multiplication
print(a + b) # Output: 13
• / : Division
• % : Modulus
print(a ** b) # Output:
• ** : Exponentiation
1000
• // : Floor Division
a=5
Comparison (Relational)
Operators
b = 10 • == : Equal to
• != : Not equal to
print(a == b) # Output: • > : Greater than
False
• < : Less than
• >= : Greater than or equal to
print(a < b) # Output: • <= : Less than or equal to
True
x = True
Logical Operators
y = False • and : Logical AND
• or : Logical OR
print(x and y) # Output: • not : Logical NOT
False

print(not x) # Output:
False
a = 10 # 1010 in binary
Bitwise Operators
b = 4 # 0100 in binary • & : AND
• | : OR
• ^ : XOR
print(a & b) # Output: 0
• ~ : NOT
• << : Zero fill left shift
print(a | b) # Output: 14
• >> : Signed right shift
a=5
Assignment Operators
a += 3 # a = a + 3 • = : Assign
• += : Add and assign
• -= : Subtract and assign
print(a) # Output
• *= : Multiply and assign
• /= : Divide and assign
• %=: M.odulus and assign
• **= : Exponent and assign//= : Floor divide and assign
x = [1, 2, 3]
Identity Operators
y=x
• is : Returns True if both variables are the same object

z = [1, 2, 3]
• is not : Returns True if both variables are not the same
object

print(x is y) # Output: True

print(x is z) # Output: False


a = [1, 2, 3, 4, 5]
Membership Operators
print(3 in a) # Output: • in : Returns True if a sequence with the specified value
True is present in the object
• not in : Returns True if a sequence with the specified
value is not present in the object
print(6 not in a) #
Output: True
Operator Precedence
Explanation
Defines the order in which operations are performed.
Example: a + b * c multiplies b and c before adding a.

Realtime Example:
result = 2 + 3 * 4 - (5 ** 2) / 5
print(result) # Output:
Practical Applications
• Mathematical computations
• Conditional statements
• Bitwise operations for performance optimization
• Data validation with identity and membership operators
Summary
• Key Points:
• Python operators are essential for performing operations on data.
• Understanding different types of operators is crucial for writing effective Python code
• Pay attention to operator precedence and common pitfalls.
Q&A Session
Invite questions and
clarify any doubts
Thank You
For your Attention

+91 8072682003

skiruthik2510@gmail.com
Zoho Show

Python operator for Presentation seminar .pdf


(This PDF has been generated using Zoho Show)

To create beautiful presentations, download Zoho Show from Play Store https://zoho.to/cy7

You might also like