How to remove all elements from a list before specific index in Python

1 Answer

0 votes
lst = ["python", "java", "c++", "c", "c#", "javascript"]
 
index = lst.index('c')

lst = lst[index:]

print(lst)  
 
 
 
 
'''
run:
 
['c', 'c#', 'javascript']
 
'''

 



answered Jul 21, 2022 by avibootz

Related questions

1 answer 140 views
1 answer 148 views
1 answer 128 views
1 answer 207 views
1 answer 195 views
...