Python Operators

Python supports different types of operators, which is like that –

  • Arithmetic operators

  • Assignment operators

  • Comparison operators

  • Logical operators

  • Identity operators

  • Membership operators

  • Bitwise operators

Arithmetic operators

These are used with a numeric value to calculate mathematical calculations.

Here some arithmetic operators which used in python mathematical calculations.

+(addition), -(subtraction), *(multiplication), /(division), etc.

 

How we can use it?

Anyone can we use it using simple syntax -

>>> a = 5

>>> b = 6

>>> c = a+b

>>> print(c)

Assignment Operator

Python support large number of assignment Operator here we choose-

=, +=, -=, *=, /=, etc

Example:

x = "hi"

print(x)

Comparison Operators

It is used to compare two variables

Here list of comparison variables are –

==, >=, <=, >, <, !=, etc

 

Example:

Output: True

x = 2
y = 2

print(x == y)

Logical Operators

Logical Operator basically performs upon the conditional operator, here some logical operator which used in python.

and, or, not

Output: True

x = 9

print(x > 2 and x < 11)

And Many other operators, like bitwise operators, etc. which used to perform upon python.

I hope it may be helpful to work with python operators, in the next tutorial we will learn how to implement lists in python

Contact Us

Tel: (+91) 0120  4118730  

Time :   10 : 00  AM -  08 : 00 PM IST 

Registered address: G-69, Sector 63, 

 Noida - 201301, India

We Provide Services Across The different countries

USA    Australia   Canada   UK    UAE    Singapore   New Zealand    Malasia   India   Ireland   Germany

CodersArts is a Product by Sofstack Technology Solutions Pvt. Ltd.

  • CodersArts | Linkedin
  • Instagram