Be a Python Pro with Enumerate

  Рет қаралды 1,051,508

Rob Mulla

Rob Mulla

Күн бұрын

Enumerate is an important built in function in #python and #coding folks should know how to use it. Don't be a noob!

Пікірлер: 946
@jan0195
@jan0195 Жыл бұрын
When you read the documentation once:
@robmulla
@robmulla Жыл бұрын
Who reads documentation? Kidding! You’re the real pro.
@samueljehanno
@samueljehanno Жыл бұрын
😯
@MemesterTheMaster
@MemesterTheMaster Жыл бұрын
I don't understand how people have difficulties understanding the documentation.... As long as you think, you are doing fine But read the thing.
@GetOffMyPhoneGoogle
@GetOffMyPhoneGoogle Жыл бұрын
TempleOS is still superior.
@originalbinaryhustler3876
@originalbinaryhustler3876 Жыл бұрын
thanks am going to read the docs
@JoeBob189
@JoeBob189 4 ай бұрын
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"?
@skylo706
@skylo706 4 ай бұрын
There is none. He shows a solution to a different problem when you have a list of objects you want to iterate and do something with. His use case/example has nothing to do with it and is just slower
@michaelbarker6460
@michaelbarker6460 4 ай бұрын
NOOB!! Jk I don't even code. I don't know why I'm here.
@andrewtate8792
@andrewtate8792 3 ай бұрын
😂😂​@@michaelbarker6460
@gandalfthegrey2777
@gandalfthegrey2777 3 ай бұрын
​@@skylo706nah what he did is exactly what you do with i in range Entire video is just satire
@SlyceDFI
@SlyceDFI 6 ай бұрын
meanwhile c/c++, c#, java, js and many others: "iterating over a list? nah havent heard of it"
@koam_
@koam_ 4 ай бұрын
bro has never heard of a foreach loop 💀
@gandalfthegrey2777
@gandalfthegrey2777 3 ай бұрын
Bro
@eugenex8892
@eugenex8892 Жыл бұрын
Don't be a noob, don't code in python :)
@robmulla
@robmulla Жыл бұрын
checkmate!
@lawrencedoliveiro9104
@lawrencedoliveiro9104 Жыл бұрын
I think we can spot the C♯/Java/PHP crowd, can’t we?
@nathanaelmccooeye3204
@nathanaelmccooeye3204 Жыл бұрын
heyyyHEEYYYWHOAWHOAWHOA!
@JimMaz
@JimMaz Жыл бұрын
How long did it take you to code this comment?
@marktuggle5609
@marktuggle5609 Жыл бұрын
Malboge is the only language for me.
@llambduh
@llambduh 11 ай бұрын
If your only goal was to take a list, give it indexes, and print it you could just do this: print(list(enumerate(todo_list))) 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.
@fingerman4086
@fingerman4086 Жыл бұрын
Enumerate is awesome but sometimes you really just need an index, and so range(len(Object)) works just fine
@msschubi
@msschubi Жыл бұрын
But you get the index with enumerate? or did i get this wrong?
@robmulla
@robmulla Жыл бұрын
Good point. There are many ways, true. Whatever suits your fancy!
@kingoreo7050
@kingoreo7050 Жыл бұрын
@@msschubii guess if you are only using the index then enumerate is a waste of time because you only need the index, not the actual value
@Pilosofia
@Pilosofia Жыл бұрын
for i in enumerate(list): ........
@blackscrow
@blackscrow Жыл бұрын
​@@Pilosofiano, that doesn't work iirc
@Adomas_B
@Adomas_B Жыл бұрын
C language family devs: look at what they need to do to mimic a fraction of out power!
@robmulla
@robmulla Жыл бұрын
We only wish we in the python community had your power! 😂 luckily all the good python packages use C backend code.
@mage3690
@mage3690 9 ай бұрын
As a C guy, I much prefer the "for .. in" construct. _Most_ use cases could just use the "for .. in" construct. Is it too much to ask for both the "for ( ; ; ) { }" _and_ the "for .. in" construct in the same language? That's what I'd like.
@Abraham_writes_random_code
@Abraham_writes_random_code 9 ай бұрын
​@@mage3690macro / ifdef
@ExceededTag6048
@ExceededTag6048 Жыл бұрын
I was literally writing code for this a minute ago, I go on shorts and I see my solution!
@robmulla
@robmulla Жыл бұрын
haha. I love that! But it's also a little bit scary.
@christophercarillo4784
@christophercarillo4784 Жыл бұрын
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
@robmulla
@robmulla Жыл бұрын
Hey! You learned something. Nice.
@godbernaz
@godbernaz Жыл бұрын
Im just starting and I had to do something similar today for my work and this appears, thanks!
@robmulla
@robmulla Жыл бұрын
Glad it could help.
@leop12768
@leop12768 10 ай бұрын
I am a noob started learning python just for fun recently. Hope I can become a pro one day.
@TeddyFitz
@TeddyFitz Жыл бұрын
Well... Under the hood it's basically doing the same thing. I suppose the code is more pythonic, but it only really improves readability if you're familiar with enumerate. Still a neat tip.
@nifegun
@nifegun 7 ай бұрын
creating a range of length whatever does seem a little silly, but the counter solution is just as good as enumerate tbh. Also I wouldn't necessarily consider any approach a noob. if you're just iterating over a short list, its not a big deal how you manage it. I'll worry about code when it counts lol
@adrisongomez6482
@adrisongomez6482 Жыл бұрын
I found it like 3 or 2 weeks ago by mistake and it’s really nice function
@robmulla
@robmulla Жыл бұрын
love it!
@foremost6233
@foremost6233 7 ай бұрын
I am a beginner and a noob in the python language. I will be a pro pythonista someday.
@popcultureprogrammer2171
@popcultureprogrammer2171 9 ай бұрын
I'm used to programming in basic, without objects alright. Its a force of habit to say for i = 0 to 20, or in python, for i in range(20). I prefer direct access most of the time anyway
@Aliarh-TRC
@Aliarh-TRC 4 ай бұрын
Well that is a built in function that can do that... but it is VERY slow in big lists, and can dramatically slow a program down with no clear sign of what is slowing things down
@pizndiz7603
@pizndiz7603 2 ай бұрын
Guys Im new to coding I still learning the Basics
@hodayfa000h
@hodayfa000h 8 ай бұрын
I would rather learn *_c++_* over python... learning *_c++_* as a beginner is hell... BUT WAS SO DAMN WORTH IT
@ahmedhassan5783
@ahmedhassan5783 9 ай бұрын
to anyone who is going too hard on themselves, you are not a noob for doing something in some way you think suits you. if it works it works all you gotta do is learn more and become better and enjoy your life. taht's all have a great day!
@AlphaChinou
@AlphaChinou Жыл бұрын
Python is dope
@robmulla
@robmulla Жыл бұрын
That we can agree on.
@temie933
@temie933 5 ай бұрын
Dead giveaway you’re a noob: using inbuilt functions for everything
@hidden_leafy
@hidden_leafy Жыл бұрын
I thought you were going to use the index lol for things in mylist: print(list.index(things), ',' ,things )
@waynelau3256
@waynelau3256 Жыл бұрын
Coding in the first two is fine. Get it to work, then optimise it.
@pastori2672
@pastori2672 4 ай бұрын
**it doesnt say shit**
@bigfoad
@bigfoad Жыл бұрын
The toxic trait of most coders is tha they choose the complicated way because it makes them look cooler. The first one worked just fine
@DrinkinPasta
@DrinkinPasta Жыл бұрын
"python is the JavaScript of programming languages"
@robmulla
@robmulla Жыл бұрын
lol. What?
@cabudagavin3896
@cabudagavin3896 Жыл бұрын
wata roast edit: I agree with Sherlock, stop calling us noobs...
@AlghostUnit
@AlghostUnit 28 күн бұрын
Oh wow ok I feel like I discovered the fire 😂
@giovannifilippa440
@giovannifilippa440 5 ай бұрын
if a thing work, you aren’t a noob, even if is simpler, if is simpler is even better, don’t you think?
@bassycounter
@bassycounter 10 ай бұрын
Nobody wants to be a certified double-noob.
@andrewhabroad
@andrewhabroad Жыл бұрын
Now build it in c++
@robmulla
@robmulla Жыл бұрын
😶
@BobChess
@BobChess 7 ай бұрын
C programmer after watching this video(They just called noob):
@jhops3120
@jhops3120 Жыл бұрын
Len(range(array)) is faster if you dont want the indecies
@Sauvenil
@Sauvenil Жыл бұрын
Why did someone decide Python was necessary? lol.
@blacklung9020
@blacklung9020 9 ай бұрын
Heyy.... thanks for information
@CrateSauce
@CrateSauce Жыл бұрын
print([i for i in range(len(list))], [i for i in list])
@robmulla
@robmulla Жыл бұрын
🤯
@darelmezui548
@darelmezui548 Ай бұрын
Are we going to talk about the actual content of the list??😂😂
@stefanf6495
@stefanf6495 Жыл бұрын
Python is a toy taken way too serious. Python Pro = professional tinkerer.
@MonicaRamirez-pf6xr
@MonicaRamirez-pf6xr 11 ай бұрын
I felt very attacked lol
@Youarethebest8
@Youarethebest8 2 ай бұрын
Me: Doesn't know shet about python Also me: Hmmmm... Smart indeed.
@SamMcPieVTOL
@SamMcPieVTOL Жыл бұрын
I really hope the 0.4 sec is how long that program ran for, because if it is, that is the most sad thing ever. I knew Python was slow, but I didn’t know it was THAT slow. It’s literally four elements haha.
@mrtbts
@mrtbts Жыл бұрын
it’s on a jupyter notebook so it tend to run a bit slower than normal python (also loops in python are slow)
@xomiachuna
@xomiachuna Жыл бұрын
Performance hit is most likely due to request being sent to the jupyter server before the actual execution starts, which could also mean the need to start ipython kernel. Python is fairly fast, loop time is measured in microseconds in this case.
@BogdanTestsSoftware
@BogdanTestsSoftware 8 ай бұрын
Where is the title function coming from?
@ignaziomessina69
@ignaziomessina69 Жыл бұрын
there is a version that uses less memory and once faster? In this cases, with mupltiple options, it's nice, for me, having a performance comparison between them
@nickleo4308
@nickleo4308 3 ай бұрын
bro pissed so many people lmaoo
@picklenickil
@picklenickil Жыл бұрын
If you bring your coffee in on your keyboard like that you don't deserve to code anymore
@robmulla
@robmulla Жыл бұрын
I’ve spilled coffee on my keyboard before.
@picklenickil
@picklenickil Жыл бұрын
@@robmulla RIP laptop?
@robmulla
@robmulla Жыл бұрын
@@picklenickil no. Just an hour of popping of keys and cleaning.
@_-tg-_
@_-tg-_ Жыл бұрын
... and with the start parameter, we can decide the starting index :)
@robmulla
@robmulla Жыл бұрын
I didn’t know about that… you my friend are a certified ULTRA PRO.
@lucaskeyworth
@lucaskeyworth Жыл бұрын
knew this from lua - for i,v in pairs(arr) do
@robmulla
@robmulla Жыл бұрын
I've always wanted to learn lua. What do you use it for?
@romania-n6q
@romania-n6q 11 ай бұрын
JS developers isn't using arguments for high array methods basics?
@halvarmc671
@halvarmc671 9 ай бұрын
I love these videos, because you can tell the person is insecure with their own capabilities. Instead of just making a tip video, you insult people.
@davidbadea1360
@davidbadea1360 Жыл бұрын
I use the counter method but with a O = 0 and I actually felt good about it until now
@anshu4190
@anshu4190 Жыл бұрын
Js developer laughing at corner
@robmulla
@robmulla Жыл бұрын
haha. It's meant to be funny.
@JimnyGirl
@JimnyGirl 10 ай бұрын
Nice
@prabhatmishra8422
@prabhatmishra8422 Жыл бұрын
Well, at least I'm not a certified double noob 🙂😂
@torinmorris6648
@torinmorris6648 Жыл бұрын
I would like to hear one good reason to not continue the i in range(len(list)): list[i] format.
@robmulla
@robmulla Жыл бұрын
This article has a few reasons: themeptation.medium.com/why-use-enumerate-instead-of-range-in-your-pythons-loops-d33bfd9c7531
@Money_2030
@Money_2030 Жыл бұрын
A medium article 💀💀
@vaishakhgk2006
@vaishakhgk2006 Жыл бұрын
@@Money_2030 It gets the job done, but not very pythonic. You have to get the length of the list to keep track of the index, then index into the array to get the current fruit - which makes the code more verbose and harder to read. This was the reason in the article😅😂
@poopfartlord9695
@poopfartlord9695 Жыл бұрын
Or you're not a noob because you're coming from an actual programming language that isn't as amazingly nice and friendly to use as python is.
@robmulla
@robmulla Жыл бұрын
You got me! 😃
@SexyRonaldo0
@SexyRonaldo0 5 ай бұрын
Probably I am a noob that actually chooses a simple way to code
@skylo706
@skylo706 5 ай бұрын
That is completely fine. As a beginner you often learn "optimal" ways to do something, making everything more complicated as it needs to be. When you work in the industry for a couple of years however, you stop doing this. Instead you choose simple solutions because you at this point have understanding of if unreadable, crazy optimazations and stuff are really benefitial because most of the time, they're not
@jonasp4682
@jonasp4682 Жыл бұрын
Hmm I do both sometimes 🫡 can't explain why
@robmulla
@robmulla Жыл бұрын
I do all three!
@jackmillen
@jackmillen Жыл бұрын
Ngl, calling people a noob is kinda a noob thing to do
@antonevstigneev846
@antonevstigneev846 Жыл бұрын
yep, because he is also a noob who doesn’t even use List comprehension
@the_w0nderful43
@the_w0nderful43 Жыл бұрын
I put dislike on both of your comments
@the_w0nderful43
@the_w0nderful43 Жыл бұрын
Noob noob noob
@jackmillen
@jackmillen Жыл бұрын
@@the_w0nderful43 Okay. Have a nice day!
@mettwasser
@mettwasser Жыл бұрын
​@@antonevstigneev846 why in ther world would he use a list comp here..? xd
@5cover
@5cover Жыл бұрын
Frankly, as long as you write clean, readable code, you're a pro to me, regardless of your knowledge of python's forensics. ❤️
@robmulla
@robmulla Жыл бұрын
That’s a fair take.
@wonderfulworldofmarkets9033
@wonderfulworldofmarkets9033 Жыл бұрын
So I went down a rabbit hole with this one. At first I thought that enumerate is worse since in assembly, its a jmp and then iterating pointer and assigning vs just iterating and assigning. Turns out in newer version of Python they have made enumerate faster than reading and assigning!
@kevinwoodrobotics
@kevinwoodrobotics 9 ай бұрын
yeah clean code makes a huge difference
@Haja024
@Haja024 4 ай бұрын
​@@geekzombie8795 Some people enjoy gaining knowledge, Brad.
@dallin5861
@dallin5861 Жыл бұрын
The other two ways are perfectly acceptable in other languages and may even be easier to read so I have no issue with them.
@robmulla
@robmulla Жыл бұрын
Ok, you win! But now people know they all exist :D
@derickd6150
@derickd6150 9 ай бұрын
Yeah honestly this is why I hate python 😂
@juliodonofreo
@juliodonofreo 9 ай бұрын
Other languages actually have a numeric for loop, and not the odd range() thing. Don't get me wrong, python's for is good and works for everything, but this range() thing is weird
@specter538
@specter538 6 ай бұрын
​@@juliodonofreo I too was really frustrated with python's for loop in the beginning. But there's a way around it. For example writing something like, for i in range(1,10,2): print(i) Is the same as writing, for(int i=1;i
@tegathemenace
@tegathemenace 3 ай бұрын
​@@specter538 in their heads it's shorter😂. Anything to stay unique I guess
@tophat593
@tophat593 Жыл бұрын
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.
@robmulla
@robmulla Жыл бұрын
Hey Tophat! I can appreciate your reaction. This short is just intended to be funny. I intentionally went over the top with the "noob" stuff just to make it more interesting in hopes that people would learn something new. Sorry if it came across too harsh.
@tophat593
@tophat593 Жыл бұрын
@@robmulla Oh, now I feel mean! I obviously got the wrong end of the stick, apologies. Don't worry in the slightest, enumerate is a nice solid thing to teach learners for sure, very handy. If I'm honest, it's what I use by default.
@jacckkaboii3528
@jacckkaboii3528 Жыл бұрын
@@tophat593 most humble argument in the youtube comment section to date.
@mast3rvnzla
@mast3rvnzla Жыл бұрын
😊
@lucasalvarani1724
@lucasalvarani1724 Жыл бұрын
​@@jacckkaboii3528 true
@blaze_eagle
@blaze_eagle Жыл бұрын
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?
@moonlightaria968
@moonlightaria968 Жыл бұрын
performance wise there doesn't seem to be much different, main advantages is its more explicit and shorter line wise, but these tend to minor concerns, it also has the advantage for working on iterables without indexes when that case comes up
@aocs13
@aocs13 Жыл бұрын
It’s easier to work with, let’s say you want to access the index or use it to relate to some data inside a list or a dictionary, is easier to access it with enumerate.
@Beeftitan
@Beeftitan Жыл бұрын
It's not better it likely works like the range does but looks "cleaner "
@lucaxtshotting2378
@lucaxtshotting2378 9 ай бұрын
yes. You have both the index and the iterated item. You don't have to worry about how to access the item with an index. It might also be faster too. Probably not though.
@lucaxtshotting2378
@lucaxtshotting2378 9 ай бұрын
@@aocs13 you should not use indexes to access dictionary items. You should use the key. If the key is the index you should use a list.
@KeepCalmCapybara
@KeepCalmCapybara 4 ай бұрын
Then I am "Pro Noob", because I use any of these methods at will 😂😂😂
@unhhgcrxexhjvuvujchcrzwzwz7956
@unhhgcrxexhjvuvujchcrzwzwz7956 7 ай бұрын
“Sorry the counter method is just because I’m so used to writing assembly in embedded systems, take that noob”
@MrCaturday
@MrCaturday Жыл бұрын
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.
@monolith757
@monolith757 Жыл бұрын
No, you just stupid, I guess. Kidding!
@TheVergile
@TheVergile Жыл бұрын
the real noob thing would be to not mention why this would be better and why people should care
@robmulla
@robmulla Жыл бұрын
You’re right!
@bobby9192
@bobby9192 Жыл бұрын
@@robmulla noob
@xsardas1999
@xsardas1999 9 ай бұрын
I'm a noob both in English and python but. Usually builtin functions in python are faster since they use lower level language. Thus when you use enumerate counters are being assigned in C. If you move this assignment into a python script by using variable inside the loop. You make it a tiny bit slower that cans tack for bigger lists. Same goes for len, you have to access index of the variable every time instead just getting it from the builtin function. And if you just need index and not content itself, you can always use throwaway variable "_"
@Fallofduty56
@Fallofduty56 8 ай бұрын
Should i go for c or python i agree im a total noob but suggest me
@lpalaguachi2
@lpalaguachi2 7 ай бұрын
​@@Fallofduty56 I've been coding for only like a month, but in my opinion you should learn Python before learning C
@user-bg1xh3yl5o
@user-bg1xh3yl5o Жыл бұрын
as a c++ user, i find it hard to believe this isn't common knowledge lmao
@818de60
@818de60 Жыл бұрын
It is
@smieszkipikczers1568
@smieszkipikczers1568 Жыл бұрын
It is common AF
@818de60
@818de60 Жыл бұрын
@@smieszkipikczers1568 ur mom common af
@robmulla
@robmulla Жыл бұрын
hah. yea I guess we all have something to learn.
@skylo706
@skylo706 4 ай бұрын
When noobs tell noobs how to code:
@anubhav9476
@anubhav9476 Жыл бұрын
python tips with davie504 style xD
@robmulla
@robmulla Жыл бұрын
SLAP LIKE NOW!
@Michael-ty2uo
@Michael-ty2uo Жыл бұрын
Bro every type of these videos explaining how to do something a "better" way in code gets spammed with comments calling the creator of the video a clown 😭
@robmulla
@robmulla Жыл бұрын
Is that bad or good? I know it's good for engagement....
@faremir
@faremir 9 ай бұрын
I'l give you example. I had to hire two new junior devs as our team grew in past month or so. We had over 300 applicants and few of them had coding channels like these. Every single one was presenting themselves like seniors with 15 years of experience and weren't even able to write proper djisktra. You're better watching people like DavesGarage instead of pseudo-helpful channels like this.
@Michael-ty2uo
@Michael-ty2uo 9 ай бұрын
@@robmulla it’s Bad if you have a community calling you a clown it’s good for short term engagement but horrible for long term engagement.
@Rajarikamvamshi
@Rajarikamvamshi Жыл бұрын
If you think, doing this make you expert then you are certified noob!
@robmulla
@robmulla Жыл бұрын
Then a noob I am! 😊
@Rajarikamvamshi
@Rajarikamvamshi Жыл бұрын
Same here
@AyatExplorer
@AyatExplorer 3 ай бұрын
POV: U've learned a knew thing & excited 2 teach ppl abt it...
@zyxwvutsrqponmlkh
@zyxwvutsrqponmlkh 6 ай бұрын
Need more special keywords. No thanks. I'll just do it like in C and I won't give half a shitake if you think I'm nuub.
@Viii498
@Viii498 Жыл бұрын
Oh, I didn’t know Python was a real programming language 😂
@robmulla
@robmulla Жыл бұрын
Yea. That’s a different issue altogether 😊
@koleso1v
@koleso1v Жыл бұрын
It is not, it is just a wrapper. All heavy libraries are written in C anyway.
@Skaffa
@Skaffa Жыл бұрын
@@koleso1v blablabla
@Alee_Calee
@Alee_Calee 3 ай бұрын
This was really helpful for my 5th grade python on-paper test, thx!
@GottZ
@GottZ Жыл бұрын
fun fact about enumerate.. it's essentially a counter so it's equal to the double noob solution.
@unhhgcrxexhjvuvujchcrzwzwz7956
@unhhgcrxexhjvuvujchcrzwzwz7956 7 ай бұрын
This video is insane. So he’s commenting on how writing a for loop like it’s written in any other language is either good or bad. Either way it’s absurd and childish
@nirbhay_raghav
@nirbhay_raghav Жыл бұрын
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!!
@robmulla
@robmulla Жыл бұрын
Thanks for watching. I tried to take a different “tone” in this video. I thought it was funny. Glad it motivates you! Keep working hard!
@shaikrahhil7234
@shaikrahhil7234 Жыл бұрын
😂😂😂😂 Why can't we use pandas module Import pandas as pd data = pd.Dataframe(given_list) Print(data)
@robmulla
@robmulla Жыл бұрын
Ohh. I actually like that idea.
@MercuryShore
@MercuryShore Жыл бұрын
Yeah let me just call a function for every tiny thing in my programing life so I don't get called a noob in a KZbin short.
@robmulla
@robmulla Жыл бұрын
Now you’re getting the idea!
@vercot7000
@vercot7000 Ай бұрын
enumerate takes about 3 seconds to type out, so yes
@prashlovessamosa
@prashlovessamosa Жыл бұрын
I am certified noob.
@robmulla
@robmulla Жыл бұрын
Plot twist: I’m actually a triple noob…. I use all three sometimes. Video is meant to be in a joking manner. Hopefully it comes across that way 😂
@Kumar-oe9jm
@Kumar-oe9jm Жыл бұрын
Are we just gg to ignore the "eat brains" 😳 😳💀💀
@testtester3249
@testtester3249 Жыл бұрын
Lol
@robmulla
@robmulla Жыл бұрын
You were the first one to catch it!
@gaurav_r13
@gaurav_r13 Жыл бұрын
Use comprehension with enumerate :: double pro 😂😂
@robmulla
@robmulla Жыл бұрын
So true
@ajmash9745
@ajmash9745 Жыл бұрын
But then you would have an array of tuples.
@CodingCorvus
@CodingCorvus Жыл бұрын
My code might not be efficient, looks like a three year old coded it. But you know what it works for what I want with it. And that in the end is what matters
@robmulla
@robmulla Жыл бұрын
I like this take. You do you! Video was meant to be funny and teach something new but I 100% agree with you.
@pfuhad3760
@pfuhad3760 Жыл бұрын
I agree 100%
@tygret
@tygret Жыл бұрын
You learn enumerate in your first programming course within the first 2 weeks. You can tell a real noob when they use enumerate for no reason and don't even use the indexes in their loop.
@robmulla
@robmulla Жыл бұрын
It’s a joke bruh 😂
@firesean_
@firesean_ Жыл бұрын
I know about enumerating. I'll still continue with for I in range(len(my_list)):
@robmulla
@robmulla Жыл бұрын
As long as you know it exists. That was my goal of the video.
@marlo8850
@marlo8850 Жыл бұрын
That’s the normal for k, v in lua loop lol, python just has to be special with extra shitty steps
@robmulla
@robmulla Жыл бұрын
Do you like lua? I’ve always wanted to learn it.
@AyatExplorer
@AyatExplorer 3 ай бұрын
Y do u prob look like pigmie? 0:04
@simon2112
@simon2112 Жыл бұрын
I honestly hate python for loops so much, why couldn't they leave it as C, java, etc for loops?
@robmulla
@robmulla Жыл бұрын
Interesting. What do you hate about them?
@1Bond007
@1Bond007 Жыл бұрын
If first methods are noob, there is nothing special in the enumerate as well.
@robmulla
@robmulla Жыл бұрын
True. But it’s more pythonic.
@ApplegateA
@ApplegateA Жыл бұрын
Cascading enumeration doesnt make sense to me. Thats why i use ranges
@robmulla
@robmulla Жыл бұрын
Ah. That’s a good point.
@victoriathomas4674
@victoriathomas4674 Жыл бұрын
Why does he kinda sound like mordecai from regular show
@robmulla
@robmulla Жыл бұрын
My kids would love to hear that! lol
@emmywraps7165
@emmywraps7165 Жыл бұрын
Don’t be a noob, use a f-string, don’t be a noob don’t code in toy languages, code in c++, don’t be a noob code in C, don’t be a noob code in asm don’t be a noob code in binary
@robmulla
@robmulla Жыл бұрын
01110101010101 01010101001010 1010100000010101 -> Sorry if the noob thing came off the wrong way, I was trying to make it over the top as a joke.
@kalyansworlld
@kalyansworlld Жыл бұрын
What is that method thing.little() I didn’t understand
@robmulla
@robmulla Жыл бұрын
Title method makes strings into a title format. Where the first letter of each word is uppercase.
@webberdontstarve7017
@webberdontstarve7017 Жыл бұрын
kinda like a for i,v in ipairs loop in lua
@robmulla
@robmulla Жыл бұрын
lua seems like a cool language. I know it's popular for scripting in game development, right?
@webberdontstarve7017
@webberdontstarve7017 Жыл бұрын
@@robmulla yeah, and it's even simpler than python. it's used in roblox, don't starve, garry's mod, and a lot of other games for modding
@pooconsumer
@pooconsumer Жыл бұрын
Yea exactly
@Luix
@Luix Жыл бұрын
that is the default way in iterators in golang
@robmulla
@robmulla Жыл бұрын
Nice! What do you use golang for?
@Luix
@Luix Жыл бұрын
@@robmulla tiny CLI apps, mostly to parse json data
@Ifian23
@Ifian23 4 ай бұрын
Oh noooo, i already upload my code using those double noob method😂
@colbyberger1881
@colbyberger1881 Жыл бұрын
Who cares its the same run time plus gets the job done
@robmulla
@robmulla Жыл бұрын
That’s a fair take.
@BritainW3llz
@BritainW3llz 3 ай бұрын
ways_to_code = ['range', 'counter', 'enumerate'] noob = 'Stop Doing It This Way' for funny_jokes in ways_to_code: if funny_jokes == 'range' or funny_jokes =='counter': print(noob) else: print('Okay, you\'re alright')
@jakob2946
@jakob2946 Жыл бұрын
WOOOOOOOOOOOOOOOOOOWWWWWWWWW this doesn't matter hahaha
@robmulla
@robmulla Жыл бұрын
You're probably right.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,8 МЛН
Coding Was HARD Until I Learned These 5 Things...
8:34
Elsa Scola
Рет қаралды 485 М.
Players vs Corner Flags 🤯
00:28
LE FOOT EN VIDÉO
Рет қаралды 70 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 16 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 38 МЛН
I made Games with Python for 10 Years...
28:52
DaFluffyPotato
Рет қаралды 338 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
How To Use List Comprehension In Python
6:41
Taylor's Software
Рет қаралды 8 М.
2 YEARS of PYTHON Game Development in 5 Minutes!
4:54
Coding With Russ
Рет қаралды 926 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 81 М.
20 Programming Projects That Will Make You A God At Coding
14:27
The Coding Sloth
Рет қаралды 1,1 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 230 М.
Oh, wait, actually the best Wordle opener is not “crane”…
10:53
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
God-Tier Developer Roadmap
16:42
Fireship
Рет қаралды 7 МЛН