Guidelines

집합(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} (λ³€κ²½ μ—†μŒ)
Mission
0 / 1

집합(Set)에 μƒˆλ‘œμš΄ μš”μ†Œλ₯Ό μΆ”κ°€ν•  λ•Œ append() λ©”μ„œλ“œλ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

O
X

Guidelines

AI Tutor

Publish

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Execution Result