THIS Drove Me Crazy Until Today #python #code #programming

preview_player
Показать описание
This drove me crazy until today in Python. #python #code #programming
Рекомендации по теме
Комментарии
Автор

I’ve always preferred the “zip on shortest” default, but it’s good to know this alternative exists!

throstlewanion
Автор

What if I want the output here to be [('A', 1), ('B', 2), ('C', 1), ('D', 2)]
What tool would I use to achieve that?

Hermaniac
Автор

fill = "_*
a = [...]
b = [...] + [fill] * max(0, len(a-b))
a += [fill] * max(0, len(b-a))

Mystery_Glitch
Автор

Newbie coder here who’s currently trying to learn Python. With this problem, could you just create an if or while loop that compares the length of the indexes and, until the lengths are the same, appends a given fill value to the shorter list until the indexes are the same length, and then you zip it? Would that be a viable alternative to importing a tool?

Ggatk
Автор

Every time I remember the first day I started to learn Python, I just burst into laughter because it was hilarious, I didn't know where to start and what to do, but after going through all those hardships, guess what I am a software engineer

Drrkdde
Автор

What if i want to zip two elems in one number?

gwynethcalo
Автор

OK, I really enjoy your channel, but calling functions "methods" is grinding my grits.
A proper function is pure: the output only depends on the inputs and never changes. It has no side-effects, while a method acts on object, and may change it, and the output depends on state.
This is a key to the zen of python, and POLA.

DrDeuteron
Автор

the content is always useful and good advice, but you're not mandatory to make people think you learned these at video making time, if you have enough level in python language to make tutorials you should know all about itertools from quite a long time ago, it is some basic knowledge for a python developer. Again, i do not say that the video is useless, it is actually always nice for beginners to have those advices, i only say it is not serving any purpose to tell you're discovering it

dragweb
welcome to shbcf.ru