[Python] dictionary

** How to make a dictionary ** {Key 1: Value 1, Key 2: Value 2} Note that the list and parentheses {} are different

fruits = {"apple":"Apple" , "banana":"banana" , "strawberry":"Strawberry"}

output Dictionary [key] Pay attention to the parentheses [] when outputting

fruits = {"apple":"Apple" , "banana":"banana" , "strawberry":"Strawberry"}

print("apple" + fruits["apple"] + "is")

Output result apple is an apple


** Element update ** Dictionary [key] = value

fruits = {"apple":"Apple" , "banana":"banana" , "strawberry":"Strawberry"}

fruits["banana"] = "Banana"

** Add element ** Dictionary [new key] = value

fruits = {"apple":"Apple" , "banana":"banana" , "strawberry":"Strawberry"}

fruits["kiwi"] = "Kiwi"

Recommended Posts

Python dictionary
[Python] dictionary
Python dictionary
[Python] Memo dictionary
[Python] Dictionary (hash)
Python Basic Course (7 Dictionary)
Python
Python3 List / dictionary memo
Python list, for statement, dictionary
Create a dictionary in Python
Python> dictionary / collections> defaultdict () / Counter ()
Python> dictionary> get ()> optional value
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Built-in python
Python comprehension
Python technique
Studying python
Notes on Python and dictionary types
Python 2.7 Countdown
Python memorandum
Python FlowFishMaster
Python service
python tips
python function ①
Python basics
Python memo
ufo-> python (3)
Expansion by argument of python dictionary
Python comprehension
Replace dictionary value with Python> update ()
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
python tips
Try python
Python memo
Python iterative
Python2 + word2vec
Dictionary type 2
Python functions
Python tutorial
python underscore
Python summary
Start python
Dictionary type 1
[Python] Sort
Note: Python
Python basics ③
python log
Python basics
[Scraping] Python scraping