Skip to main content

Command Palette

Search for a command to run...

Basics of Python-7

Published
2 min read
Basics of Python-7
P

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.

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 !

More from this blog

Priya's blog

46 posts

Python Developer@Codeclause Mentee @Trailhead Salesforce Content Executive @GDSC SIT'22-23 Google Women Techmakers Ambassador @Google WTM Coreteam @ GirlScript Kolkata