Set Assignments
Write a python program to remove duplicate from a list using set.
Write a program to carry out the following operations on the given set s = {10, 2, -3, 4, 5, 88} 1. number of items in set s 2. maximum element in set s 3. minimum element in set s 4. sum of all elements in set s 5. obtain a new sorted set from s, set s remaining unchanged 6. report whether 100 is an element of s 7. report whether -3 is an element of s
A Set contains names which begins either with A or with B, write a program to separate out the names into two sets, one containing names beginning with A and another containing names beginning with B.
Create an empty set. Write a program that add five new names to this set, modifies one existing name and deletes two name existing in it.
Write a program to show the difference between the two set functions discard() and remove().
Write a program to create a set containing 10 randomly generated numbers in the range 15 to 45. Count how many of these numbers are less than 30. Delete all the numbers which are greater than 35.
You are given a string remove the duplicates from that string using set.
Write a python program to create a set using user input.
Write a python program to iterate over set.
Take two sets and print the set after union of both the sets.(You can either create a set through random module and through user input).
Take two sets and print the set after intersection of both the sets.
Take two sets A and B and print the whether A is the subset of B.
Take two sets A and B and print whether A is the superset of B or not.
Take a string from user and print the unique count of vowels in the string.
Write a Python program that takes two sets as input and prints the common elements between the two sets.
Write a Python program that takes two sets as input and prints the elements that are in the first set but not in the second set.
You have a list of customers who have purchased products from your online store. You want to identify customers who have purchased from your store in the past month and customers who have not made any purchases in the past month. How can you use sets to accomplish this task?
You are the owner of a restaurant and you want to identify the most popular menu items among your customers. You have a list of all menu items that have been ordered in the past month. How can you use sets to identify the most popular menu items?
You are the manager of a retail store and you want to identify which products are selling well and which products are not. You have a list of all products sold in the past month. How can you use sets to identify the top selling products and the least selling products?
You are a data analyst and you want to identify the most common words used in a text document. You have a list of all words used in the document. How can you use sets to identify the most common words?
You have a list of orders and their respective statuses (e.g. "pending", "shipped", "delivered"), and you want to count the number of orders in each status. How can you use sets to accomplish this task?
Last updated