# ilshift() function in python by R4R Team

-ilshift() is a python function predefined in operator module.
-It work on the numeric value, it shift the binary bit to the left side.

Syntax-

operator.ilshift(number,leftshift)

Example-

operator.ilshift(3,1) will return 6

How?

Binary of 3 is 00000011 then,
(3,1) means left shift one time then above binary number become - 00000110,
00000110 is 6 in decimal.

program-

import operator
print("Enter number")
n=int(input())
print('left shift of this number 1 time is ',operator.ilshift(n,1))
print('left shift of this number 2 time is ',operator.ilshift(n,2))
print('left shift of this number 3 time is ',operator.ilshift(n,3))
print('left shift of this number 4 time is ',operator.ilshift(n,4))
print('left shift of this number 5 time is ',operator.ilshift(n,5))
print('left shift of this number 6 time is ',operator.ilshift(n,6))

output-

Enter number
3
left shift of this number 1 time is 6
left shift of this number 2 time is 12
left shift of this number 3 time is 24
left shift of this number 4 time is 48
left shift of this number 5 time is 96
left shift of this number 6 time is 192

Enter number
4
left shift of this number 1 time is 8
left shift of this number 2 time is 16
left shift of this number 3 time is 32
left shift of this number 4 time is 64
left shift of this number 5 time is 128
left shift of this number 6 time is 256

-In this program, we find the left shift of the user input number and display it.

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!