Basics of Python-7

Photo by Chris Ried on Unsplash

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 !