Python Basics Lambda List Comp Dict Comp and Node Lists

Pubblicato il: 17 giugno 2026
sul canale di: Stephen Blum
56
5

Today we are learning Python list comprehension, dictionary comprehension, and lambda. Lambda lets you write a small function inline, like lambda n: n * 2, and you can pass that function into another function. We used that idea to manipulate numbers, like doubling a value or adding 10.

We also used filter with a lambda to keep only numbers that are five or more. Next we sorted a list of chatters with scores using sorted and a key function, like key=lambda c: c[1], and we flipped it to descending order by using a negative value. After that, we reviewed list comprehension as a for loop inside brackets that builds a new list, and we added an if at the end to filter items.

Finally we looked at dictionary comprehension and simplified it by removing enumerate when it was not needed, which made the code cleaner while still filtering out None values.


In questa pagina del sito puoi guardare il video online Python Basics Lambda List Comp Dict Comp and Node Lists della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Stephen Blum 17 giugno 2026, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 56 volte e gli è piaciuto 5 spettatori. Buona visione!