Code:-
print("Enter element of the list")
mylist=list(map(int,input().split()))
mid=len(mylist)//2
new_list_1=mylist[ :mid] # copying half element into new list 1
new_list_2=mylist[mid: ] # copying next half element into new list 2
print("First new list is:-")
print(new_list_1)
print("Second new list is :-")
print(new_list_2)
Output:-
Enter element of the list
1 2 3 4 5 6 7 8 9 0
First new list is:-
[1, 2, 3, 4, 5]
Second new list is :-
[6, 7, 8, 9, 0]
0 Comments