Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit a03d86c

Browse files
made changes to 3_sort_concat
1 parent e4c8d31 commit a03d86c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Sets1and2/3_sort_and_concat.py

+17-3
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,24 @@
55

66
def sort_concat(list1, list2):
77
'''
8-
takes two lists, sorts and concatenates them to return a new list
8+
assuming the question is to
9+
take two lists, sort the first list and concatenate these values index wise to the values from second list
10+
'''
11+
list1.sort()
12+
for i in range(len(list2)):
13+
#print(list1[i])
14+
list1[i] = list1[i] + " " + list2[i]
15+
16+
17+
18+
19+
sort_concat(list1, list2)
20+
print(list1)
21+
22+
def sort1_concat(list1, list2):
23+
'''
24+
if the question is to sort the lists and simply concatenate them
925
'''
1026
return(sorted(list1) + sorted(list2))
1127

12-
new_list = sort_concat(list1, list2)
13-
print(new_list)
1428

0 commit comments

Comments
 (0)