티스토리 뷰
딕셔너리: key, value
중첩
* Dictionary
{ key : value }
{ key1:value1, key2:value2, ... }
키는 "문자", 숫자 123, 등 datatype을 구별한다
# Retrieving items for dictionary
programming_dictionary = {
"Bug": "An error in a program that prevents the program from running as expected.",
"Function": "A piece of code that you can easily call over and over again.",
"Loop": "The action of doing something over and over again.",
}
print(programming_dictionary["Function"])
--------------------------------------------------------------------------------------------------
A piece of code that you can easily call over and over again.
# Adding new items to dictionary
programming_dictionary["kio"] = "Hansome guy in south Korea."
print(programming_dictionary)
--------------------------------------------------------------------------------------------------
{'Bug': 'An error in a program that prevents the program from running as expected.', 'Function': 'A piece of code that you can easily call over and over again.', 'Loop': 'The action of doing something over and over again.', 'kio': 'Hansome guy in south Korea.'}
# Create an empty dictionary
empty_dictionary = {}
# Wipe an existing dictionary
programming_dictionary = {}
# Edit an item in a dictionary
programming_dictionary["kio"] = "Really hansome"
# Loop through a dictionary
for key in programming_dictionary :
print(key)
----------------------------------------------------------------------------------------------------------
Bug
Function
Loop
kio
for key in programming_dictionary :
print(key)
print(programming_dictionary[key]
----------------------------------------------------------------------------------------------------------
Bug
An error in a program that prevents the program from running as expected.
Function
A piece of code that you can easily call over and over again.
Loop
The action of doing something over and over again.
kio
Hansome guy in south Korea.
'Test > Python(20220101~)' 카테고리의 다른 글
Days9_Lists, Dictionary 중첩 (0) | 2022.01.13 |
---|---|
Day9_Dictionary, 점수를 가지고 등급 매기는 프로그램 (0) | 2022.01.12 |
Day8_Caesar 암호 최종, 코드 재구성(하나의 함수로 정리) (0) | 2022.01.10 |
Day8_Caesar 암호 2단계, decode (0) | 2022.01.10 |
Day8_Caesar 암호 1단계, encoding (0) | 2022.01.09 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- artandculture
- exadata
- dezoomify
- 대소문자
- dp-2
- 3par
- powershell
- 차집합
- dp-1
- fromkeys
- 정렬
- storage
- 배열
- EXA
- insert
- vmware.powercli
- virt-sysprep
- 읽어오기
- oracle
- 부동없이
- cloud-init
- 스토리지
- sysprep
- powercli
- set()
- LIST
- 중복제거
- 변수화
- vmware
- Join
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함