Quiz Catalog

Catalog of quizzes

s1 = {1, 2, 3, 4, 5}
s2 = {3, 4, 5}

print(len(s2 - s1))
0
  • set/operation/difference

lang1 = {"C++", "C", "C#", "Java", "Perl"}

lang2 = lang1.copy()
lang2.update(
  ["C", "Python", "C++",  "JavaScript", "PHP"]
)

print(*lang2.difference(lang1))
'JavaScript' 'PHP' 'Python'
  • set/operation/difference
  • set/operation/update