Problem Description
Python Program to Merge Two Lists and Sort it
Input
Number of elements in the list 1
Elements of the List 1
Number of Elements in in the List 2
Element of List 2
Output
Print the sorted ListCODING ARENA
a=int(input())
x=input().split()
b=int(input())
y=input().split()
z=[]
for i in range(a):
z.append(int(x[i]))
for i in range(b):
z.append(int(y[i]))
z.sort()
print("Sorted list is:",*z)
Test Case 1
Input (stdin)2 67 43 2 22 11
Expected OutputSorted list is: 11 22 43 67
Test Case 2
Input (stdin)3 28 65 56 2 43 29
Expected OutputSorted list is: 28 29 43 56 65
No comments:
Post a Comment