## Arithmetic  & Assignment Operators in Python

``````#----------------------------- 1- Arithmetic Operator -------------------------------

num = int(input("Enter the 1st number : "))
num2 = int(input("Enter the 2nd number : "))

add = num + num2    # returns the sum of the given numbers

# - Subtraction operator

diff = num - num2   # returns the difference of the given numbers
print("The difference is ",diff)

# * Multiplication operator

mul = num * num2    # returns the product of the given numbers
print("The product is ",mul)

# / Division operator

div = num / num2    # returns the division of the given numbers
print("The division value is ",div)

# % Modulus operator

rem = num % num2    # returns the remainder of the given numbers
print("The remainder  is ",rem)

# ** Exponentiation operator

exp = num ** num2   # returns the a power b (a^b) of the given numbers
print("The exponent value is ",exp)

# // Floor division operator

flr = num // num2   # rounds the quotient to whole number of the given numbers
print("The floor value is ",flr)

``````
``````#----------------------------  2- Assignment Operator -------------------------------

num  = 7
#  =  Assign
num = 5 # assigns 5 to num even when assigned before

print("\nThe value of ",num ,"after assigning is : ",num)

num  =17

num += 12 # which is equal to num = num + 8
print("\nThe value of ",num ,"after adding is : ",num)

num  =34

#  -= subract and Assign
num -= 4 # which is equal to num = num - 8
print("\nThe value of ",num ,"after subracting is : ",num)

num  =21

#  *= Multiply and Assign
num *= 5 # which is equal to num = num * 8
print("\nThe value of ",num ,"after multiply is : ",num)

num  =6

#  /= Divide and Assign
num /= 7 # which is equal to num = num / 8
print("\nThe value of ",num ,"after division is : ",num)

num  =17

#  %= Modulus and Assign
num %= 4 # which is equal to num = num % 8
print("\nThe value of ",num ,"after modulus is : ",num)

num  =13

#  //= floor and Assign
num //= 9 # which is equal to num = num // 8
print("\nThe value of ",num ,"after floor is : ",num)

num  =2

#  **= Exponent and Assign
num **= 5 # which is equal to num = num ** 8
print("\nThe value of ",num ,"after exponent is : ",num)

num  =7

#  &= bitwise AND and Assign
num &= 8 # which is equal to num = num & 8
print("\nThe value of ",num ,"after bitwise AND is : ",num)

num  =8

#  |= bitwise OR and Assign
num |= 2 # which is equal to num = num | 8
print("\nThe value of ",num ,"after bitwise OR is : ",num)

num  =5

#  ^= bitwise XOR and Assign
num ^= 6 # which is equal to num = num ^ 8
print("\nThe value of ",num ,"after bitwise XOR is : ",num)

num  =7

#  >>= shift Right and Assign
num >>= 9 # which is equal to num = num >> 8
print("\nThe value of ",num ,"after right shift is : ",num)

num  =9

#  <<= shift Left and Assign
num <<= 9 # which is equal to num = num << 8
print("\nThe value of ",num ,"after left shift is : ",num)

``````

## For More Details

Our internship program guarantees personalized attention for optimal career development in the tech industry.

## +91 97879 68375

-> You should bring your own laptop during the internship

Who can apply?

Internships are open for students who: B.E / B.Tech / M.E / M.Tech / B.Sc / M.Sc / M.C.A / B.C.A / Diploma.

• Ongoing Students Only
• days, 5days/ 10days or Based on Student Preference
• Limited 1 to 10 students per slot
• Registration fees : 1000 INR
• Slots are filling quickly only fewer slots are available