본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 13

반응형

Q>

1. 아래와 같은 인벤토리가 있다.

가격 개수
500 291
320 586
100 460
120 558
92 18
30 72


2. 위에 인벤토리에 총 합을 구하시오.

3. 판매 금액은 가격에 90%만 받을수 있다.


A>

inven = {'item1':500, 'item2':320, 'item3':100, 'item4':120, 'item5':92, 'item6':30}
inven_count = {'count1':291, 'count2':586, 'count3':460, 'count4':558, 'count5':18, 'count6':72}

result_list1 = []
result_list2 = []

for v1 in inven.values():
a = result_list1.append(v1)
for v2 in inven_count.values():
b = result_list2.append(v2)

count = 0

for v1, v2 in zip(result_list1, result_list2):
count += (v1 * v2) * 0.9

print(count)

'O>

404816.4


Process finished with exit code 0


반응형

'Python_Matter > Solve' 카테고리의 다른 글

Python Learn the basics Quiz 15  (0) 2019.03.27
Python Learn the basics Quiz 14  (0) 2019.03.27
Python Learn the basics Quiz 12  (0) 2019.03.18
Python Learn the basics Quiz 11  (0) 2019.03.18
Python Learn the basics Quiz 10  (0) 2019.03.18