Check sibling questions
Computer Science - Class 12
Chapter 14 - Functions in python

Write a function called remove First that accepts a list as a parameter. It should remove the value at index 0 from the list. Note that it should not return anything (returns None). Note that this function must actually modify the list passed in, and not just create a second list when the first item is removed. You may assume the list you are given will have at least one element.

 

Answer:

def removeFirst (l):

    l.pop( 0 )

    return

 

Explanation:

  • The pop( ) function is an built-in function which removes the element at the position mentioned as the argument.
  • ‘l’ is the list .

Are ads bothering you?

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.