Skip to content

Commit c442c87

Browse files
authored
Update solution.hide.py
1 parent 3244157 commit c442c87

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
from operator import itemgetter
22

33
# Your code here
4-
def sort_tuples_ascending(tuples):
5-
tuple_list = [tuple(item.split(',')) for item in tuples.split()]
4+
def sort_tuples_ascending(data):
5+
tuples_list = [tuple(entry.split(',')) for entry in data]
66

7-
sorted_list = sorted(tuple_list, key=itemgetter(0, 1, 2))
7+
sorted_tuples = sorted(tuples_list, key=itemgetter(0, 1, 2))
88

9-
return sorted_list
9+
return sorted_tuples
1010

11-
print(sort_tuples_ascending("Tom,19,80 John,20,90 Jony,17,91 Jony,17,93 Jason,21,85"))
11+
example_input = [
12+
'Tom,19,80',
13+
'John,20,90',
14+
'Jony,17,91',
15+
'Jony,17,93',
16+
'Jason,21,85'
17+
]
18+
19+
result = sort_tuples_ascending(example_input)
20+
print(result)

0 commit comments

Comments
 (0)