Basics of Python-7
Day 7
Set :
Set is an in-built data type in python. It is an unordered collection of data.
It is iterable
It is mutable
It has no duplicates
Let's solve a few problems on set :
- Find the maximum and minimum in a Set :
s=([67,34,27,45,1])
print(set(s))
print(max(set(s)))
print(min(set(s)))
output :
- To convert a set into a list
s={1,6,3,4}
print(list(s))
output:
Problems on Set :
Write a python program to check if two lists have at least one element common
Write a python program to find common elements in three lists using sets
Write a python program to find missing and additional values in two lists
Write a python program to find the difference between two lists
Write a python program to find a lost element from a duplicated array
Write a python program to count the number of vowels using sets in a given string
Write a python program to concatenated string with uncommon characters in Python
Write a python program to accept the strings which contain all vowels
Write a python program to check if a given string is a binary string or not
Write a python program to check if the string is an anagram
Write a python program for pairs of complete strings in two sets
In my next blog,you will get to know about dictionary data types.
Thank You !
Subscribe to my newsletter
Read articles from Priya Chakraborty directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Priya Chakraborty
Priya Chakraborty
Hello, I'm Priya Chakraborty, a dedicated B.Tech student in Electrical Engineering at Siliguri Institute Of Technology. I'm an enthusiastic learner, constantly seeking to expand my skill set and knowledge base. With a solid foundation in programming languages such as C, R, Python, and MySQL, I'm poised to tackle complex technical challenges. But my passions extend beyond the realm of engineering. I'm also an aspiring content writer, driven by a curiosity to communicate ideas, both technical and non-technical, in a way that captivates and educates. My journey is defined by a relentless pursuit of self-improvement, coupled with strong communication skills. I believe in the power of continuous learning and the importance of sharing knowledge.