This article is about python programming skills from afternerd
Python Lambdas

Python Lambdas Explained (With Examples)
Why we need lambdas (difference between traditional functions)
lambdas are only useful when you want to define a one-off function.
In other words, a function that will be used only once in your program. These functions are called anonymous functions.
Python Enumerate

Python Enumerate Explained (With Examples)
How do I get the index of an element while I am iterating over a list?
The pythonic way is to use built-in
enumeratefunction
enumerate list
1 | L = ['apples', 'bananas', 'oranges'] |
other enumerate
- enumerate tuple
- enumerate list of tuples
- enumerate a string
- Enumerate with a Different Starting Index
Python: How to Sort a List?

Python: How to Sort a List? (The Right Way)
Two ways:
sort: object methodsorted: built-in function
Contents:
- Sorting a list of numbers
- Sorting a list of strings
- Sorting a list of strings in a case insensitive manner
- Sorting a list of tuples
- Sorting a list of tuples by the second element
- Sorting a list of objects
Useful parameters:
reversekey
Python Lists: Append vs Extend

Python Lists: Append vs Extend (With Examples)
append
The append method is used to add an object to a list.
This object can be of any data type, a string, an integer, a boolean, or even another list.
extend
extend is another very common list method.
Unlike append that can take an object of any type as an argument, extend can only take an iterable object as an argument.