Write a Python program that displays a specified list after removing the 0 th , 2nd, 4 th and 5 th elements.

Python / Data Types in Python

167

Program:

Peoples_names = ["John", "Peter","Sam", "Tim", "Janet", "Dan"]
Peoples_names = [x for (i, x) in enumerate (Peoples_names) if i not in (0, 2, 4, 5)]
print (Peoples_names)

Output:

['Peter', 'Tim']

Explanation:


This Particular section is dedicated to Programs only. If you want learn more about Python. Then you can visit below links to get more depth on this subject.