We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 845b464 commit 809c404Copy full SHA for 809c404
Collections/CollectionsOrderedDict.py
@@ -4,6 +4,7 @@
4
Domain : Python
5
Author : Ahmedur Rahman Shovon
6
Created : 15 July 2016
7
+Updated : 08 February 2023
8
Problem : https://www.hackerrank.com/challenges/py-collections-ordereddict/problem
9
"""
10
@@ -16,8 +17,9 @@
16
17
record_list = re.split(r"(\d+)$", input().strip())
18
item_name = record_list[0]
19
item_price = int(record_list[1])
- item_od[item_name] = (
20
- item_price if item_name not in item_od else item_od[item_name] + item_price
21
- )
+ if item_name not in item_od:
+ item_od[item_name] = item_price
22
+ else:
23
+ item_od[item_name] = item_od[item_name] + item_price
24
for i in item_od:
- print(i + str(item_od[i]))
25
+ print(f"{i}{item_od[i]}")
0 commit comments