merging two lists in python
Python Program to get two lists and merge them into single list.
Sample Input 1:
3 5 4 2 4 9 7 6 3
Sample Output 1:
5 4 2 9 7 6 3
Try your Solution
Strongly recommended to Solve it on your own, Don't directly go to the solution given below.
#write your code here
		
		
		
		Program or Solution
			
				
			
					
l1=list(map(int,input("Enter Numbers:").split()))
l2=list(map(int,input("Enter Numbers:").split()))
l3=[None]* (len(l1)+len(l2))
k=0
for i in range(0,len(l1)):
    l3[k]=l1[i]
    k+=1
for i in range(0,len(l2)):
    l3[k]=l2[i]
    k+=1
print(l3)
			
				
			
		
		
					
		
		
								
		Program Explanation
Create a new list with size of size of a list + size of b list. l3 = len(l1) + len(l2) visit elements of list l1 and store it in l3. l3[k]=l1[i] visit elements of list l2 and store it in l3. l3[k]=l2[i]Comments
Related Programs
- list input in python
 - sum of list in python | without using built-in function
 - Average of list in python | without using built-in function
 - linear search in python
 - largest element in the list python | without using built-in function
 - smallest element in the list python | without using built-in function
 - Print all the numbers which are less than given key element from a given list.
 - delete element in list python
 - Revese the elements in list python
 - Reverse the first half of list elements in python
 - Reverse the second half of list elements in python
 - list sort python
 - list sort descending order python
 - Python Program to sort half of the list elements in ascending order and next half in descending order.
 - Python Program to replace every element with the greatest element on right side
 - circular list rotation in python
 
                
                coming Soon
                
            
            
                
                coming Soon
            
        
