Help us understand the problem. What is going on with this article?

MEMO20190909-02

まだまだ電車が動かないので引き続きおべんきょうする

辞書型

{key: Value}
なんだかjsonみたい

dict = {
    'key001': 'value001',
    'key002': 'value002',
    'key003': 'value003',
}

みたいなかんじ

tmp1 = dict['key001']
print(tmp1)
# ’value001’がprintされる

みたいなかんじ

dict['key004'] = 'value004'
tmp4 = dict['key004']
print(tmp1)
# ’value004’がprintされる

みたいな感じでkeyに対応したvalueを突っ込める。
※既存のkeyに対して行うと上書きする。

point_dict = {
    '001': (100, 88, 81),
    '002': (77, 94, 85),
    '003': (80, 52, 99)
}

tmp1 = point_dict['001'][0]
print(tmp1) #100が表示される 

こんな感じでvalueにリストとかタプルとかもぶっこめる。keyの方にもタプルはぶっこめるみたい

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away