+ 1

How enumerate function works?

enumerate (value,start=index value)

9th Jan 2023, 6:22 AM
Amit Joe
Amit Joe - avatar
6 odpowiedzi
+ 5
Amit Joe , here is a sample of how enumerate can be used: https://code.sololearn.com/ccLhuM7TZT93/?ref=app
9th Jan 2023, 4:34 PM
Lothar
Lothar - avatar
+ 4
value there is a iterator. So it's value, is indexed sequentially from start index. For ex: value = [ 'a', 'b', 'c', 'd' ] for i, j in enumerate(value, start=1) : print(i, ':', j) This prints : 1 : 'a' 2 : 'b' 3 : 'c' 4 : 'd'
9th Jan 2023, 7:50 AM
Jayakrishna 🇮🇳
+ 4
Yes. It is useful to get indexed iterators, so you can make like a mapping. If you don't put start value, the default start value is 0.
9th Jan 2023, 8:03 AM
Jayakrishna 🇮🇳
+ 2
so start only change the index value not element
9th Jan 2023, 7:56 AM
Amit Joe
Amit Joe - avatar
+ 1
ok
9th Jan 2023, 8:25 AM
Amit Joe
Amit Joe - avatar
+ 1
thanks i understand where and how to use enumerate thanks
9th Jan 2023, 4:55 PM
Amit Joe
Amit Joe - avatar