set.issubset() method in Python

PHOTO EMBED

Sun Oct 20 2024 21:17:46 GMT+0000 (Coordinated Universal Time)

Saved by @pynerds #python

integers = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

evens = {0, 2, 4, 6, 8}
odds = {1, 3, 5, 7, 9}

#check for subsets
print(integers.issubset(integers)) #it is a subset of itself
print(evens.issubset(integers)) #True
print(odds.issubset(integers)) #True
content_copyCOPY

https://www.pynerds.com/set-issubset-method-in-python/