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 117 views
1 answer 129 views
1 answer 109 views
1 answer 188 views
1 answer 174 views
...