Python Practice › Set Programs › Program 47

Books two readers both own

EasySet Programs · 47 of 48

Write a Python program to create two sets of books and find the books in both.

Advertisement
Output
['Atomic Habits', 'Wings of Fire']

Approach

  1. &.

Solution

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

More set programs

← All 48 Set Programs

Leave a Comment