Top 5 Python Tricks¶
- List comprehensions:
[x*x for x in range(10)] - Unpacking:
a, b = b, a - F-strings:
f"Hello, {name}!" - The
enumerate()function for loops - Using
zip()to iterate over multiple lists
Try them out in your next project!
[x*x for x in range(10)]a, b = b, af"Hello, {name}!"enumerate() function for loopszip() to iterate over multiple listsTry them out in your next project!