Be a Python Pro with Enumerate

preview_player
Показать описание
Enumerate is an important built in function in #python and #coding folks should know how to use it. Don't be a noob!
Рекомендации по теме
Комментарии
Автор

Ngl, calling people a noob is kinda a noob thing to do

jackmillen
Автор

Frankly, as long as you write clean, readable code, you're a pro to me, regardless of your knowledge of python's forensics. ❤️

cover
Автор

The other two ways are perfectly acceptable in other languages and may even be easier to read so I have no issue with them.

dallin
Автор

I've been coding python for more decades than I care to admit and if someone used the first two I wouldn't think they're "noobs", it's perfectly fine. Or conversely, that using the enumerate function is anything to show off about.

The fact you think it's advanced says more about you than anything else.

tophat
Автор

Don't be a noob, don't code in python :)

eugenex
Автор

meanwhile c/c++, c#, java, js and many others:

"iterating over a list? nah havent heard of it"

SlyceDFI
Автор

But why is it so much better?
Does it help improve Data management? Is it faster? does it have any substantial advantege against just going through an Loop with the iterable Object range?

blaze_eagle
Автор

I see you have spiced thing up come 2023. It is fun to watch. Love to see you work hard everyday with all the shorts and streams. I see that the freq of streams have increased. This motivates me to work harder! Thank you GM!!

nirbhay_raghav
Автор

the real noob thing would be to not mention why this would be better and why people should care

TheVergile
Автор

This was really helpful for my 5th grade python on-paper test, thx!

Alee_Calee
Автор

Enumerate looked so complicated to me at first when I was a total beginner. Now I kinda feel stupid, it's super easy. But feeling stupid is part of being a programmer I guess.

MrCaturday
Автор

C language family devs: look at what they need to do to mimic a fraction of out power!

Adomas_B
Автор

Really? Youre going to shame people for using the "for i in range"?

It is a core concept in Python, and does exactly what it needs to. Can you give a technical reason for *why* you shouldnt use "for i in range"?

JoeBob
Автор

Enumerate is awesome but sometimes you really just need an index, and so range(len(Object)) works just fine

fingerman
Автор

If your only goal was to take a list, give it indexes, and print it you could just do this:



You can lose the loop, it entails unnecessary overhead for loop control. You had unnecessary string manipulation with the call to the .title() which also cost time. The print function you use in the loop introduces overhead because of the underlying system calls it makes. Making multiple prints can be slower than a single print, especially if there's a lot of data to print.

llambduh
Автор

“Sorry the counter method is just because I’m so used to writing assembly in embedded systems, take that noob”

unhhgcrxexhjvuvujchcrzwzwz
Автор

as a c++ user, i find it hard to believe this isn't common knowledge lmao

bgxhylo
Автор

Me watching the video:
Doesn't enumerate come from itertools tho?
Me after a quick Google search:
Oh nice, it's a built-in function

christophercarillo
Автор

Im just starting and I had to do something similar today for my work and this appears, thanks!

godbernaz
Автор

I found it like 3 or 2 weeks ago by mistake and it’s really nice function

adrisongomez