Python Operators

Arithmetic Operators

print(10+3)    13
print(10-2)      8
print(10*3)     30
print(10/3)      3.3333333333333335 
this ( / ) operator will always return a floating value
print(10/2)      5i.0
print(10//3)     3
and this ( // ) will return an integer value 
print(10//2)    5
print(10%3)   1
print(10**3)   1000
this ( ** ) operator is power of operator.

Assignment operators

x==3
Following are augmented or enhanced assignment operators
x+=3
x*=3 
x/=3 
x//=3
x%=3  
  

Operator precedence

Parenthesis
Exponantiation or power
multiplication 
division / or //               <<<doubt which first
modulus
addition
subtraction










Comments

Popular posts from this blog

First_Come_First_Serve CPU Scheduling

Reversing stack Method 2 !! (One Helper Stack only)

Populating Next Right Pointers in Each Node in O(1) space (without queue and level order)

Calculate factorial of large numbers !! (Using Arrays)

Multiplication of large numbers (Given in string format)

Left View of Binary Tree (Method 1 using recursion)

Check Bracket Sequence

Image Multiplication

Boundary Traversal of binary tree

BST to greater sum tree