파이썬 - 집합(set)
집합(set) 집합(set) 생성 집합 생성에는 중괄호 또는 내장 함수를 사용한다. my_set = {"apple", "banana", "cherry"} print(my_set) {'banana', 'apple', 'cherry'} # 집합(set) 함수를 이용해 생성하거나 # 리스트, 튜플, 문자열 등을 set() 함수의 인자값으로 사용해 생성한다. my_set_2 = set(["one", "two", "three"]) my_set_2 = set(("one", "two", "three")) print(type(my_set_2)) print(my_set_2) {'three', 'one', 'two'} my_set_3 = set("aaabbbcccdddeeeeeffff") print(my_set_3) {'..
프로그래밍 언어/파이썬
2021. 2. 15. 15:53