All Courses
Python Operator

Python Operator

May 17th, 2019 python

Python Operators

Operators are inbuilt methodology to execute certain manipulation with the given data or operand. Operand  is a Variables or inputs. Operators is a Function to be executed.

Types of Operators

  1. Arithmetic Operators
  2. Comparison (Relational) Operators
  3. Assignment Operators
  4. Logical Operators
  5. Bitwise Operators
  6. Membership Operators
  7. Identity Operators

Artithmetic Operators:

( +,  –  , *  , //, / , % )

Example:
Input1 = 10Input = 20Output = Input1  + Input 2Print(Output)

Comparison (or) Relational Opertors:

(< , > , <= , >= , == , !=)

Example:
Input1 = 10Input2 = 20
If Input2>Input1:
Print(“Input2 is greater than Input1)

Assignment Operators:

(+=, *= , -= , %= , /= , //=)

Example:
Count = 0For x in range(10):
X += 10
Print(Count)

Logical operators:

( AND,  NOT, OR)

Example:
Input = “Python is programming:For x,y in enumerate(Input):
If x%2 == 0 OR y == i:
Print(x,y)

Bitwise Operators:

(&,|,^,~,<<,>>)

Membership Operators:

(IN , NOT IN)

Example:
Input_Data = “Python is programming”
Vowels = “aeiou”:
For x in Input_Data:
If x in Vowels:
Print(x)

Identity Operators:

(IS, NOTIS)

Example:
Input_Data = “Dhoni”
Print(Input_Data.isupper())
Social Share:

0 responses on "Python Operator"

Leave a Message

Your email address will not be published. Required fields are marked *