Python Controleer of item in een set bestaat
Controleer of het item in een set bestaat
Gebruik het in
trefwoord om te bepalen of een bepaald item in een set aanwezig is:
Voorbeeld
Controleer of "appel" in de set aanwezig is:
thisset = {"apple", "banana", "cherry"}
if "apple" in thisset:
print("Yes, 'apple' is in this set")