항목이 세트에 존재하는지 Python 확인
항목이 세트에 존재하는지 확인
지정된 항목이 세트에 있는지 확인하려면 in
키워드 를 사용하십시오.
예시
세트에 "apple"이 있는지 확인하십시오.
thisset = {"apple", "banana", "cherry"}
if "apple" in thisset:
print("Yes, 'apple' is in this set")
지정된 항목이 세트에 있는지 확인하려면 in
키워드 를 사용하십시오.
세트에 "apple"이 있는지 확인하십시오.
thisset = {"apple", "banana", "cherry"}
if "apple" in thisset:
print("Yes, 'apple' is in this set")