Thursday, December 17, 2020

python day 12 topic set

 '''day12

topic: set



s1={1,2,3}

print(s1)

print(type(s1))



s1={"apple","banana","oranges"}

print(s1)

print(type(s1))


s1={"apple",1,True,"banana",3,"angira",2}


print(s1)

print(type(s1))



a =True

print(True+True)


print(False+False)

print(True+False)


b1={"vodka","zen","wine"}

print(b1)

b1.add("rum")

print(b1)

b1.add("kf")

print(b1)


b1={"vodka","zen","wine"}

print(b1)

b1.clear()

print(b1)


b1={"vodka","zen","wine"}

print(b1)

b2=b1.copy()

print(b2)

b3=b2.copy()

print(b3)



x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


z = x.difference(y)

k = y.difference(x)


print(z)

print(k)



x = {"apple", "banana", "cherry"}

print(x)


y = {"google", "microsoft", "apple"}

x.difference_update(y)



print(x)




fruits = {"apple", "banana", "cherry"}

print(fruits)


fruits.discard("banana")


print(fruits)



x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


z = x.intersection(y)


print(z)



x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


x.intersection_update(y)


print(x)



x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "facebook"}


z = x.isdisjoint(y)


print(z)


x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


z = x.isdisjoint(y)


print(z)


x = {"a", "b", "c"}

y = {"f", "e", "d", "c", "b", "a"}


z = x.issubset(y)


print(z)



x = {"f", "e", "d", "c", "b", "a"}

y = {"a", "b", "c"}


z = x.issuperset(y)


print(z)




fruits = {"apple", "banana", "cherry"}


fruits.pop()


print(fruits)


fruits = {"apple", "banana", "cherry"}


fruits.remove("banana")


print(fruits)



x = {"apple", "banana", "cherry","panda"}

y = {"google", "microsoft", "apple","panda"}


z = x.symmetric_difference(y)


print(z)


x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


x.symmetric_difference_update(y)


print(x)


x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


z = x.union(y)


print(z)

'''


x = {"apple", "banana", "cherry"}

y = {"google", "microsoft", "apple"}


x.update(y)


print(x)





























python class topic video