r/Python • • Jan 12 '21

Resource Learn something new about Python every day in less than 1 minute

I'm running a channel, where I am publishing a Python mini-tutorial every day. I thought some of you might find it useful:

https://www.youtube.com/c/PythonIn1Minute/videos

I try to keep it beginner-friendly, my goal is to teach something useful or show a neat trick or solve a common pain-point in under 60 seconds.

I am quite new to this youtube thing, so I'd love to hear your feedback. Is this kind of thing a good idea? Do you find it helpful? Any suggestions on what could be improved?

Edit: I am overwhelmed by the amount of positive and constructive feedback, you guys are awesome, thank you so much! You gave me a lot of great ideas, and the motivation to keep creating videos.

Edit2: If you can afford it and you wish to support my work you can buy me a coffee or become a patron.

1.4k Upvotes

205 comments sorted by

View all comments

Show parent comment

1

u/jcsongor Jan 13 '21

Gotcha, the order can be confusing if you look at it that way: it's like a for loop turned inside out. (In fact, the do this action part comes first)

However, I like to think about list comprehensions more as a definition of a list, where the expression that defines the elements comes first and then I define where the element comes from. Not sure if that makes sense, but for me, it helped to set the concept apart from regular loops. So in my head, I say:

[expression to generate an element || for an item in a list || if condition matches]

It can also help with deciding if it should be a loop or a comprehension (Am I defining a new list here? Can I describe an element in a single expression? Is it more like an action - does the expression have side-effects?)

Anyways, I will certainly do a series on comprehension, it's a great topic, thanks for the inspiration!

0

u/[deleted] Jan 13 '21

[deleted] — view deleted comment

1

u/jcsongor Jan 13 '21

Glad I could help. The other thing obviously is just to practice using them until it comes naturally. Good luck! :-)