How to remove values to a python array?

By ayush goel in 22 Sep 2023 | 04:09 pm
ayush goel

ayush goel

Student
Posts: 346
Member since: 21 Sep 2023

How to remove values to a python array?

22 Sep 2023 | 04:09 pm
0 Likes
divas goyal

divas goyal

Student
Posts: 453
Member since: 22 Sep 2023

my_list = [1, 2, 3, 4, 5]

my_list.remove(3)  # Removes the first occurrence of 3

popped_value = my_list.pop(1)  # Removes and returns the element at index 1

del my_list[0]  # Deletes the element at index 0


22 Sep 2023 | 06:32 pm
0 Likes

Report

Please describe about the report short and clearly.