Python Enumerate Function - Python Quick Tips

preview_player
Показать описание
This python quick tips video covers the enumerate function used in python for loops. The enumerate function in python allows you to iterate by both index and item.

🔥 Subscribe for more python quick tips 🔥

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡

Tags:
- Tech With Tim
- Python Tutorials
- Python Enumerate Function
- Python Enumerate
- Enumerate Python
- Enumerate for Loop Python

#Python #PythonEnumerate
Рекомендации по теме
Комментарии
Автор

Thanks for the tip! This helped out tremendously with replacing a single character in a list which I struggled to figure out for hours. This is my first time in a long time messing around with python and your vids have been very useful!

Mariokart
Автор

Thank you Tim! Super simple explanation really helped me understand the simplicity of using the enumerate function.

charlottejoytrudgill
Автор

this was quick, and exactly what I needed

jephrennaicker
Автор

I think correct substitute would be:

count = 0
for i in mylist:
print(count, i)
count +=1

chrislee
Автор

Hey Tim! Can you make a tip about that syntax please:
def f(*, kwarg_1=1, kwarg_2=2):
pass
I think this is useful syntax which is most of the people dont know. I use that when I am making a class with so many kwargs.

sevcandincel
Автор

Thank you soo much! Big hug from Brazil!

gustavopedro
Автор

oh wow! very clear on enumerate function!!!! thanks a ton!

sheilaquan
Автор

amazing how much faster it is to learn in youtube then from reading

karrde
Автор

You are a genius and a great professor! Thanks a lot!

multitaskprueba
Автор

This is so useful i would have saved so much time if i knew this

hello-myot
Автор

Hello! How can we print like 0. apple 1. pears 2. oranges 3. fruits?

dennis
Автор

Great video, I just don't get the, print("Count is 1") why is that needed

roomwithmoose
Автор

Thanks Tim. What I don't get though, is why 'x' in "for x, element in enumerate(my_list):" returned the index. That is, why it is understood that the very first variable after 'for', in this instance, 'x', should refer to the index of the elements, when normally it would not? Or is it something to do with a very specific structure, 'for x', followed by a comma?

johntobin
Автор

Thanks! I think I just wasn't getting that "x, element" are treated as multiple arguments, and that enumerate() takes two arguments, but this helped me get that.

JayGrrrl
Автор

Great video. I'm quite new to coding and this was very direct and easy to understand.

alexfraughton
Автор

To the point and really good explained, thank you!!

marianagonzales
Автор

everything was clear, but what was the purpose of equalizing x to 1?

maqsuteskendir
Автор

So x == 1
Says: If the element is in index 1 print "x is 1".
And not if x is true, write "x is 1".
I understand it right?

ronisneer
Автор

Hi, I'm new to Python.

I request to explain the output of the following code --

mylist=[23, 56, "KOL", 13, "KOL"]
for i in enumerate (mylist):
if (i[1]=="KOL"):
print(i)
O/P - (2, 'KOL')
(4, 'KOL')

sudiptomitra
Автор

This is helpful.
Btw, why is my sublime text not displaying different colors in codes? They're all gray...

nickole