Print Indices | Python

austinleath

March 2nd, 2021 12:32:56 PM

					
# List lst = [1, 2, 3, 'Alice', 'Alice'] # One-Liner indices = [i for i in range(len(lst)) if lst[i]=='Alice'] # Result print(indices) # [3, 4]

Featured Posts