λ°μν
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 | 31 |
Tags
- mysql
- Extended Slices
- Do it
- νλ‘κ·Έλλ¨Έμ€
- dacon
- java
- MacOS
- λ°μ€κ·Έλν
- νμ λ³μ
- 2BPerfect
- BFS
- ν©ν λ¦¬μΌ μ§λ²
- sql
- μμ΄
- PYTHON
- μ΄μ§μ λ³ν
- λΈλΌμ°μ μ€ν
- jdbc
- λ°±μ€
- matplotlib
- μλ°
- DFS
- Do_it
- μ°Έμ‘° λ³μ
- λ€μ΅μ€νΈλΌ μκ³ λ¦¬μ¦
- μ΅μ
- np.zeros_like
- μ§ κ° μμΈ‘ λΆμ
- μ΄κ²μ΄ μ·¨μ μ μν μ½λ©ν μ€νΈλ€
- μ ν ν¬ νμ΄μ¬
Archives
- Today
- Total
π¦ κ³΅λ£‘μ΄ λμ!
ν΄μ λ³Έλ¬Έ
- μμμ κΈΈμ΄λ₯Ό κ°λ λ©μμ§λ₯Ό μ λ ₯λ°μ κ³ μ λ κΈΈμ΄μ ν΄μκ°μ μΆλ ₯νλ ν¨μ
λμ λ리 μ½μ
hash=dict()
hash={}
hash[1]='apple'
hash['banana']=3
hash[(4,5)]=[1,2,3]
hash[10] = dict({1:'a',2:'b'})
λμ λ리 μμ
hash[1]='melon'
hash['banana']=10
λμ λ리 κ° μΆμΆ
hash.pop(1) 'melon'
hash.pop('banana') 10
hash.pop((4,5)) [1,2,3]
hash.pop(10) {1:'a',2:'b'}
λμ λ리 μμ
del hash[1]
del hash['banana']
λμ λ리 νμ©
- λμ
λ리 루ν
- hash = dict()
- hash.keys()
- ν€ κ° μΆμΆ
- hash.values()
- κ° μΆμΆ
- hash.items()
- ν€μ κ° μΆμΆ
- hash.keys()
- hash = dict()
hash=dict()
for i in range(1,6):
hash[i]=i**2
for k in hash.keys():
print(k)
for v in hash.values():
print(v)
for k,v in hash.items():
print(k,v)
- λμ
λ리 μ λ ¬
- sorted()
- listνμ μΌλ‘ λ°ν
hash=dict({1:10,3:12,5:7,7:6,4:5}) sorted(hash.keys(),key=lambda x : x) [1,3,4,5,7] sorted(hash.values(),key=lambda x : x) [5,6,7,10,12] sorted(hash.items(),key=lambda x : x) [(1,10),(3,12),(4,5),(5,7),(7,6)] sorted(hash.keys(),key = lambda x : -x) [7,5,4,3,1] sorted(hash.values(),key = lambda x : -x) [12,10,7,6,5] sorted(hash.items(),key=lambda x : -x) ERROR tupleμ μμκ°μ΄ μ μ©λμ§ μλλ€. sorted(hash.items(),key=lambda x : -x[1]) μ μ©λ¨ sorted(hash.items(),key=lambda x : "") (x[0], x[1]) key μ€λ¦μ°¨μ, value μ€λ¦μ°¨μ (-x[0], x[1]) key λ΄λ¦Όμ°¨μ, value μ€λ¦μ°¨μ (x[1], x[0] value μ€λ¦μ°¨μ, key μ€λ¦μ°¨μ
- sorted()
λ°μν
'Development > CodingTest' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[λ°±μ€] Python ν΄μ±(hashing) (0) | 2022.01.18 |
---|---|
[νλ‘κ·Έλλ¨Έμ€] Python μμ£Όνμ§ λͺ»ν μ μ (0) | 2022.01.13 |
[νλ‘κ·Έλλ¨Έμ€] Python λΉλ°μ§λ (0) | 2022.01.09 |
[λ°±μ€] Python μ§λ²λ³ν (0) | 2022.01.09 |
[λ°±μ€] Python ν©ν λ¦¬μΌ μ§λ² (0) | 2022.01.09 |
Comments