Table of Contents

    How to Remove Elements from a List in Python: A Step-by-Step Guide

    Python provides the remove() function which is used to remove the element from the list. Consider the following example to understand this concept.

    Example

    
    list = [0,1,2,3,4]     
    print("printing original list: ");    
    for i in list:    
        print(i,end=" ")    
    list.remove(2)    
    print("\nprinting the list after the removal of first element...")    
    for i in list:    
        print(i,end=" ")  
    

    Output

    
    printing original list: 
    0 1 2 3 4 
    printing the list after the removal of first element...
    0 1 3 4