“Daftar Python Hapus ()” Kode Jawaban

Python hapus

# the list.remove(object) method takes one argument 
# the object or element value you want to remove from the list
# it removes the first coccurence from the list

generic_list = [1, 2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]

generic_list.remove(1)

# The Generic list will now be:
# [2, 2, 2, 3, 3, 4, 5, 5, 5, 6, 8, 8, 8]

McBurd

Daftar Python Hapus ()

Python Program to remove an element from the list
# list of cars
cars = ['Benz','BMW','Ford','Ferrari','volkswagen']

# remove Ferrari car from the list
cars.remove('Ferrari')

# Updated car list
print("Updated Car list = ",cars)
Gorgeous Gazelle

Del (Daftar) Python

del[a:b] #This will delete everything from range A to B
Modern Macaque

Jawaban yang mirip dengan “Daftar Python Hapus ()”

Pertanyaan yang mirip dengan “Daftar Python Hapus ()”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya