Notice
Recent Posts
Recent Comments
Link
| ์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- setTimeout()
- js
- ๊ฒ์
- ajax
- https://m.blog.naver.com/tt2t2am1118/221010125300
- ๋น๋๊ธฐ
- ๋๊ธฐ
- await
- Porject
- object
- addEventListener
- eport
- slow and steady
- db
- https://youtube.com/playlist?list=PLuHgQVnccGMA5836CvWfieEQy0T0ov6Jh&si=FTaYv8m21EhO-A2K
- sql
- database
- prj
- ์ฐธ๊ณ ๋ธ๋ก๊ทธ
- json
- async
- Import
- webpack
- callback
- JS #ํ๋ก์ ํธ
- Project
- mysql
- promise
- ํผํ
- execCommand
Archives
- Today
- Total
C-log
Welcome to Python : ์งํฉ ์๋ฃํ ๋ณธ๋ฌธ
728x90
- ๋ฌธ์์ด ์๋ฃํ : https://hi-code.tistory.com/110
- ๋ฆฌ์คํธ ์๋ฃํ : https://hi-code.tistory.com/111
- ํํ ์๋ฃํ : https://hi-code.tistory.com/112
- ๋์ ๋๋ฆฌ ์๋ฃํ : https://hi-code.tistory.com/113
- ์งํฉ ์๋ฃํ : https://hi-code.tistory.com/114
| Title | Code | Console |
| ์งํฉ ์๋ฃํ | ||
| ์งํฉ ์๋ฃํ ๊ธฐ๋ณธ ๊ตฌ์กฐ |
s1 = set([1, 2, 3])
print(s1)
|
{1, 2, 3} |
|
s2 = set("Hello")
print(s2)
|
{'e', 'H', 'l', 'o'} | |
| ๋ฆฌ์คํธ, ํํ๊ณผ ์งํฉ์ ์ฐจ์ด |
s1 = set([1, 2, 3])
#๋ฆฌ์คํธ๋ก ๋ณํ
l1 = list(s1)
print(l1)
print(l1[0])
|
[1, 2, 3] 1 |
|
#ํํ๋ก ๋ณํ
t1 = tuple(s1)
print(t1)
print(t1[0])
|
(1, 2, 3) 1 |
|
| ๋ฆฌ์คํธ๋ ํํ์ ์ธ๋ฑ์ฑ([0])์ ํตํด ์์๊ฐ ์์ง๋ง ์งํฉ(set)์๋ฃํ์ ์์๊ฐ ์๊ธฐ์ ์ธ๋ฑ์ฑ([0])์ ํตํ ์์๊ฐ์ ์ป์ ์ ์๋ค. ๋ง์ฝ ์งํฉ(set)์ ์ธ๋ฑ์ฑ์ผ๋ก ์ ๊ทผํ๊ธฐ ์ํด์ '๋ฆฌ์คํธ'๋ 'ํํ'๋ก ๋ณํ ํ ํด์ผ ํ๋ค. |
||
| ๊ต์งํฉ |
s1 = set([1, 2, 3, 4, 5, 6])
s2 = set([4, 5, 6, 7, 8, 9])
print(s1 & s2)
print(s1.intersection(s2))
|
{4, 5, 6} {4, 5, 6} |
| ํฉ์งํฉ |
s1 = set([1, 2, 3, 4, 5, 6])
s2 = set([4, 5, 6, 7, 8, 9])
print(s1 | s2)
print(s1.union(s2))
|
{1, 2, 3, 4, 5, 6, 7, 8, 9} {1, 2, 3, 4, 5, 6, 7, 8, 9} |
| ์ฐจ์งํฉ |
s1 = set([1, 2, 3, 4, 5, 6])
s2 = set([4, 5, 6, 7, 8, 9])
print(s1 - s2)
print(s2 - s1)
print(s1.difference(s2))
print(s2.difference(s1))
|
{1, 2, 3} {8, 9, 7} {1, 2, 3} {8, 9, 7} |
| Title | Code | Console |
| ์งํฉ ์๋ฃํ ๊ด๋ จ ํจ์ | ||
| add |
s1 = set([1, 2, 3])
s1.add(4)
print(s1)
|
{1, 2, 3, 4} |
| update |
s1 = set([1, 2, 3])
s1.update([4, 5, 6])
print(s1)
|
{1, 2, 3, 4, 5, 6} |
| remove |
s1 = set([1, 2, 3])
s1.remove(2)
print(s1)
|
{1, 3} |
728x90
'๐Python' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| Welcome to Python : if๋ฌธ (0) | 2023.07.09 |
|---|---|
| Welcome to Python : ๊น์ ๋ณต์ฌ ์์ ๋ณต์ฌ (0) | 2023.07.09 |
| Welcome to Python : ๋์ ๋๋ฆฌ ์๋ฃํ (0) | 2023.07.08 |
| Welcome to Python : ํํ ์๋ฃํ (0) | 2023.07.08 |
| Welcome to Python : ๋ฆฌ์คํธ ์๋ฃํ (0) | 2023.07.07 |
Comments