Quick actions

cmd+k|ctrl+k

Navigation

Languages

73 - enumerate

Snippet info

Language

Python

Visibility

public

Author

ciawash

Created

2024-04-09T10:59:04.900336Z

Updated

2024-04-09T11:27:36.503964Z

for i,char in enumerate("Hello"):
    print(i, char)
    
# What if we have a tuple?

for i,char in enumerate((1,2,3)):
    print(i, char)
    
# I wanna know the index of the 50th element in the range:
for i,char in enumerate(list(range(100))):
    if char == 50:
        print(f'index of 50 is: {i}')
    
    
INFO