Item Index

>>> a_list = list('abzcd')
>>> a_list.index('z') 
2

Delete by index

List Items Deletion

>>> del a_list[2]         
>>> a_list
['a', 'b', 'c', 'd']
# del is a not a function, it's just a keyword

String Deletion

>>> a_string = 'Hello' 
>>> del a_string
>>> a_string
NameError: name 'a_string' is not defined

Number Deletion

>>> a_num = 100
>>> del a_num 
>>> a_num 
NameError: name 'a_num' is not defined

 

Remove by value

>>> my_list = [1,2,3,1]
>>> my_list.remove(1)
>>> my_list
[2,3,1]

>>> my_list.remove(1)
>>> my_list
[2,3]

>>> my_list.remove(1)
>>> my_list
Exception error thrown!

Vowels Removal

lower( )  ,  capitalize( ) 

# [devowel.py]
state_names = ["Alabama", "Califronia", "Oklahoma", "Florida" ]
vowels = list('aeiou')
output = []

for state in state_names:
  state_list = list(state.lower())
  
  for vowel in vowels: 
    while True: 
      try: 
        state_list.remove(vowel)
      except: 
        break
  output.append(''.join(state_list).capitalize())
  
print(output)

OUTPUT:

workspace$ python devowel.py
['Lbm', 'Clfrn', 'Klhm', 'Flrd']