Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
568 B
2
Indexable
Never
Given a Python list sample_list = ["Blue", "Green", "Red"], write a program to add all its elements 

into a given set. sample_set = {"Yellow", "Orange", "Black"} [Hint: use update () function]

2. Write a python code to return a new set of identical items from two sets, also return a new set with 
unique items from both sets by removing duplicates. set1 = {10, 20, 30, 40, 50}; set2 = {30, 40, 50, 
60, 70}.
3. Write a python code to remove items from set1 that are not common to both set1 and set2; set1 = 
{10, 20, 30, 40, 50}; set2 = {30, 40, 50, 60, 70}
Leave a Comment