Python

초보자를 위한 파이썬 300제 / 06. 파이썬 딕셔너리 / 091 ~ 100

TTwY 2020. 8. 25. 14:30
728x90
반응형

06. 파이썬 딕셔너리 / 091 ~ 100

 

# 파이썬 300제 _ 91번
# inventory = {"메로나": [300, 20], "비비빅": [400, 3], "죠스바": [250, 100]}
# print(inventory)

# 파이썬 300제 _ 92번
# inventory = {"메로나": [300, 20], "비비빅": [400, 3], "죠스바": [250, 100]}
# print(inventory["메로나"][0], "원")

# 파이썬 300제 _ 93번
# inventory = {"메로나": [300, 20], "비비빅": [400, 3], "죠스바": [250, 100]}
# print(inventory["메로나"][1], "개")

# 파이썬 300제 _ 94번
# inventory = {"메로나": [300, 20], "비비빅": [400, 3], "죠스바": [250, 100]}
# inventory["월드콘"] = [500, 7]
# # inventory.update({"월드콘": [500, 7]})
# print(inventory)

# 파이썬 300제 _ 95번
# icecream = {'탱크보이': 1200, '폴라포': 1200, '빵빠레': 1800, '월드콘': 1500, '메로나': 1000}
# ice = list(icecream.keys())
# print(ice, type(ice))

# 파이썬 300제 _ 96번
# icecream = {'탱크보이': 1200, '폴라포': 1200, '빵빠레': 1800, '월드콘': 1500, '메로나': 1000}
# ice = list(icecream.values())
# print(ice, type(ice))

# 파이썬 300제 _ 97번
# icecream = {'탱크보이': 1200, '폴라포': 1200, '빵빠레': 1800, '월드콘': 1500, '메로나': 1000}
# ice = list(icecream.values())
# print(sum(ice))

# 파이썬 300제 _ 98번
# icecream = {'탱크보이': 1200, '폴라포': 1200, '빵빠레': 1800, '월드콘': 1500, '메로나': 1000}
# new_product = {'팥빙수': 2700, '아맛나': 1000}
# icecream.update(new_product)
# print(icecream)

# 파이썬 300제 _ 99번
# keys = ("apple", "pear", "peach")
# vals = (300, 250, 400)
# result = dict(zip(keys, vals))
# print(result)

# 파이썬 300제 _ 100번
# date = ['09/05', '09/06', '09/07', '09/08', '09/09']
# close_price = [10500, 10300, 10100, 10800, 11000]
# close_table = dict(zip(date, close_price))
# print(close_table)
728x90
반응형