RUVIDEO
Поделитесь видео 🙏

Intermediate Python 7. Enumerate 영어 파이썬 코딩영어 смотреть онлайн

LC training(0:29) - First let's say we're just going to say an example equals left right up and down and what we're going to say is we'll just do will do for i in range len example print i example i So this is an example of code that you might find yourself writing to product the following like Basically any time you find yourself or i would say most of the time i'm trying to think of an example where i've not been screwing up when i do this But pretty much anytime yo're going to say for i in range of a length of something you're probably doing it wrong okay So just keep that in mind i've done it probably No i know i've done in some of the tutorials for sure just because like i just never use enumerate I just don't think about it But lately in my own code i've been trying to use enumerate just because it exists and you should do it so Anyways this is not the right way to go about it Instead what you should say is something like this for i j in enumerate example print i j I'll print the other one just to do it i guess but as you can see this one ended here or this the first one this is the second one Exact same output just a little cleaner um it makes a little bit more sense It's the way it's supposed to be you're also not doing like this range len nonsense You just don't need to so don't do it So that's one example of enumerate for most people that's probably all you need to do You can use enumerate over a dictionary and a lot of other iterables I would show you a dictionary You can go to the sample code if you really want to see it But it's basically the exact same thing as we just did here

Summary & Code results -


초급 12강 diagonal winner 알고리즘에서 우린 enumerate() built-in function을 활용해 game_board를 만들어내어 본 적이 있습니다.
it's going to return a tuple containing basically the count along the way and then the object itself or the item itself that you were iterating over.

example = ['left', 'right', 'up', 'down']
for i in range(len(example)):
print(i, example[i])

pretty much anytime you're going to say for i in range of a length of something you're probably doing it wrong. this is not the right way to go about it. let's fix it like the following:

for i, j in enumerate(example):
print(i, j) # prints counter, item value of the tuple

그리고 우린 dictionary data type 으로도 전환해내어 보았습니다.

new_dict = dict(enumerate(example)) # this case produces dictionary dataset
print(new_dict) # prints key made by count, item value of the dictionary
[print(i, j) for i, j in enumerate(new_dict)] # i is enumerate count, j is the key value of dictionary
[print(i, j) for i, j in enumerate(example)] # i is enumerate count, j is item value of tuple
-----------------------------------------------------------------------
0 left
1 right
2 up
3 down
{0: 'left', 1: 'right', 2: 'up', 3: 'down'}
0 0
1 1
2 2
3 3
0 left
1 right
2 up
3 down
[Finished in 138ms]


원본 비디오: https://www.youtube.com/watch?v=bOGmYvtw-kk&list=PLQVvvaa0QuDfju7ADVp5W1GF9jVhjbX-_&index=8

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Intermediate Python 7. Enumerate 영어 파이썬 코딩영어» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.