μ§ν©(Set)μ μμ μΆκ°νκΈ°
Setμ μλ‘μ΄ μμλ₯Ό μΆκ°ν λλ add()
ν¨μλ₯Ό μ¬μ©ν©λλ€.
λ§μ½ μΆκ°νλ €λ μμκ° μ΄λ―Έ setμ μ‘΄μ¬νλ€λ©΄, setμ λ³κ²½λμ§ μμ΅λλ€.
setμ μμ μΆκ°νκΈ°
my_set = {1, 2, 3} print("my_set:", my_set) # {1, 2, 3} my_set.add(4) # my_setμ 4 μΆκ° print("add 4:", my_set) # {1, 2, 3, 4} # μ€λ³΅ μμ μΆκ° μλ my_set.add(2) # my_setμ 2 μΆκ° μλ print("add 2:", my_set) # {1, 2, 3, 4} (λ³κ²½ μμ)
Guidelines
AI Tutor
Publish
Design
Upload
Notes
Favorites
Help
Code Editor
Run
Generate
Execution Result