Answers for "is it better to use enumerate or range len"

1

how to use enumerate instead of range and len

using enumerate instead of range or len
a = [f(n) for n, _ in enumerate(L)]

using range and len
a = [f(n) for n in range(len(L))]
Posted by: Guest on June-13-2020

Code answers related to "is it better to use enumerate or range len"

Python Answers by Framework

Browse Popular Code Answers by Language