Q. Write a program that accepts a list and removes the value at index 0 from the list. The program must actually modify the list passed in, and not just create a second list with the first item removed.

You may assume the list you are given, will have at least one element.

For example:

for input word is a = [1, 2, 3, 4], the output should be [2, 3, 4]

Answer :-
lst = eval (input ("Enter the List :- "))
lst.pop(0)
print (lst)
Output :-

Enter the List :- [1,2,3,4,5,6]
[2, 3, 4, 5, 6]
>>>
Enter the List :- ["Portal", "Path", "Walla"]
['Path', 'Walla']
>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post