Python - Remove List Items

Published: 03 July 2024
on channel: Developers Vision
6
0

Remove Specified Item

The remove() method removes the first matching element (which is passed as an argument) from the list.

create a list
prime_numbers = [2, 3, 5, 7, 9, 11]

remove 9 from the list
prime_numbers.remove(9)

Updated prime_numbers List
print('Updated List: ', prime_numbers)

Output: Updated List: [2, 3, 5, 7, 11]


On this page of the site you can watch the video online Python - Remove List Items with a duration of hours minute second in good quality, which was uploaded by the user Developers Vision 03 July 2024, share the link with friends and acquaintances, this video has already been watched 6 times on youtube and it was liked by 0 viewers. Enjoy your viewing!