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 List
#Here the N value has no use, its here for the question only. #check out the Input 3 and 4 having get input without N values. #N1=int(input('Enter N value for list1 : ')) l1=list(map(int,input('Enter the values for list1 : ').split(' '))) #N2=int(input('Enter N value for list2 : ')) l2=list(map(int,input('Enter the values for list2 : ').split(' '))) print('Sorted list is:',(*sorted(l1+l2)))
Input_1:
Enter N value for list1 : 2
Enter the values for list1 : 67 43
Enter N value for list2 : 2
Enter the values for list2 : 22 11
Output:
Sorted list is: 11 22 43 67
Input_2:
Enter N value for list1 : 3
Enter the values for list1 : 28 65 56
Enter N value for list2 : 2
Enter the values for list2 : 43 29
Output:
Sorted list is: 28 29 43 56 65
Input_3:
Enter the values for list1 : 69 5 22 3658 45
Enter the values for list2 : 6 55 846 325 75 96 100
Output:
Sorted list is: 5 6 22 45 55 69 75 96 100 325 846 3658
Input_4:
Enter the values for list1 : 9 6 3 4 8 5 7 2
Enter the values for list2 : 5 3 2 8 7 4 9 6 5
Output:
Sorted list is: 2 2 3 3 4 4 5 5 5 6 6 7 7 8 8 9 9
Morae Q!
- Convert Numbers into Roman Numerals
- Return the size of the longest sub-string
- Return all strings in words which is sub-string of another word in any order.
- Calculate the step by step sum of startValue plus elements in array.
- Find the minimum number of Fibonacci numbers whose sum is equal to k.
- Given a string s of zeros and ones, return the maximum score after splitting the string.
- Write a efficient functions to find floor of x.
- Print all numbers less than n which are having digits only 3 or 7 or both.
- Function that returns true if given array can be divided into pairs.
- Find the smallest element in the list that is larger than the given target.
- Print the First N prime numbers.
- The Chef’s Binary Tree.
- The minimum number of strikes he will have to make.(so that all his enemies have the same name)
- Sum of Natural Numbers.
- Sum of the Input.
- Find the Sum of the Series: 1 + 1/2 + 1/3 + .. + 1/N.
- Split elements into even and odd list
- Python Program to Merge Two Lists and Sort it.
- Median of Three.
- Find the Largest Number in a List.