Python Practice › Set Programs › Program 47
Books two readers both own
Write a Python program to create two sets of books and find the books in both.
Output
['Atomic Habits', 'Wings of Fire']
Approach
&.
Solution
asha = {"Wings of Fire", "The Alchemist", "Atomic Habits"}ravi = {"Atomic Habits", "Sapiens", "Wings of Fire"}print(sorted(asha & ravi))Output
['Atomic Habits', 'Wings of Fire']
Learn the concept
New to this topic? Read the lesson, then come back.