Basics of Python-7

Day 7

Set :

Set is an in-built data type in python. It is an unordered collection of data.

  1. It is iterable

  2. It is mutable

  3. It has no duplicates

Let's solve a few problems on set :

  1. 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 :

  1. To convert a set into a list
s={1,6,3,4}
print(list(s))

output:

Problems on Set :

  1. Write a python program to check if two lists have at least one element common

  2. Write a python program to find common elements in three lists using sets

  3. Write a python program to find missing and additional values in two lists

  4. Write a python program to find the difference between two lists

  5. Write a python program to find a lost element from a duplicated array

  6. Write a python program to count the number of vowels using sets in a given string

  7. Write a python program to concatenated string with uncommon characters in Python

  8. Write a python program to accept the strings which contain all vowels

  9. Write a python program to check if a given string is a binary string or not

  10. Write a python program to check if the string is an anagram

  11. 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 !

0
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.