← Back to challenges

Potential Friend?

PythonHardlanguage_fundamentalsarraysvalidation

Instructions

Given two sets of two people's different interests, return whether both people have at least two things in common or have exact interests. Return True if there's a potential friend!

Examples

is_potential_friend(
  {"sports", "music", "chess"},
  {"coding", "music", "netflix", "chess"}
) ➞ True

is_potential_friend(
  {"cycling", "technology", "drawing"},
  {"dancing", "drawing"}
) ➞ False

is_potential_friend(
  {"history"},
  {"history"}
) ➞ True

Notes

Sets of interests may have varied lengths.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Check if One List is a Subset of Another