• Python question of the day

    What is the output of executing the following code snippet:
    my_list = [2,3,4,5,6,4]
    my_list.remove(4)
    print(my_list)
     [2, 3, 4, 5, 4]
     [2, 3, 5, 6, 4]
     [2, 3, 5, 6]
     Runtime Error
    Explanation:
    In python, remove(x) method of a list will remove the FIRST occurance of x (searching from left to right) if it is in the list, throws an error if it is not in the list


    Top 100 python interview questions:






datai analytics