## Membership, Bitwise  Operators in Python

``````#----------------------------- 1-Membership Operator -------------------------------

var = input("Enter the name : ")
var2 = input("Enter the value to search : ")

lst = [8,3,5,2,12]
lst2 =[8,3,82,89,121,67,12]
num = int(input("Enter the number to search inthe list : "))

# for values
if var2 in var: # returns True if specified value is  present in the object
print(var2.capitalize()," is in the name.")
elif var2 not in var:    # returns True if specified value is not present in the object
print(var2.capitalize()," is not in the name.")
else:
print()

# for list or tuples
if num in (lst2 or lst):    # returns True if specified value is  present in the list
print("Yes,", num, " is in the list")
elif num not in (lst2 or lst):    # returns True if specified value is not present in the object
print("Yes,", num, " is not in the list")
else:
print()

``````
``````#----------------------------- 1-Bitwise Operator -------------------------------

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

# All operation are done on basis of the binary values (0 s and 1 s, Eg: 00011100,1101011)

# & - bitwise and , Sets each bit to 1 if both bits are 1
print("AND")
ands = num & num2
print(ands)
print()

# | - bitwise or ,Sets each bit to 1 if one of two bits is 1
print("OR")
ors = num | num2
print(ors)
print()

# ^ - bitwise xor, Sets each bit to 1 if only one of two bits is 1
print("XOR")
xor = num ^ num2
print(xor)
print()

# ~ - bitwise not, Inverts all the bits	(if 01 ,then 10)
nots =  ~ num
nots2 = ~ num2
print("Not")
print(nots)
print(nots2)
print()

# << - bitwise shiftLeft,   pushing zeros in from the right and let the leftmost bits fall off
shiLef = num << num2
print("Shift Left")
print(shiLef)
print()

# >> - bitwise shiftRight, pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off
shiRig = num >> num2
print("Shift Right")
print(shiRig)
print()

``````

## 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