Looks neat, right? But let’s slow down.
The
The starred variable always gets a list, and it can be empty so plan accordingly when unpacking, especially in function arguments or loops.
For example: Consider the following code
No error, but
The
*b syntax is called extended iterable unpacking. It grabs everything in the middle of the list, leaving the first item (a) and the last (c) outside the star. This pattern is super handy, but can also behave unexpectedly if you assume it’ll grab just one item or not consider the structure of the data.The starred variable always gets a list, and it can be empty so plan accordingly when unpacking, especially in function arguments or loops.
For example: Consider the following code
x, *y = [42]
print(y) # []
No error, but
y is just an empty list! Unpacking doesn’t always fill every name the way you might guess.❤1👍1
Given the above Python code, what will be printed?
Anonymous Quiz
14%
"hello"
69%
"olleh"
10%
"" (empty string)
7%
Error
❤2
140+ Python Practice Programs - For Real Learning, Not Just Theory
Struggling with Python logic?
Here's over 140 real Python programs that will help you to understand how code actually works-beyond the tutorials.
From basics to interview-level logic:
Arithmetic & conversions
Loops, Recursion, Lists, Arrays
Prime, Fibonacci, Armstrong logic
Matrices, Sorting, Factorials & more
Python pdf
Struggling with Python logic?
Here's over 140 real Python programs that will help you to understand how code actually works-beyond the tutorials.
From basics to interview-level logic:
Arithmetic & conversions
Loops, Recursion, Lists, Arrays
Prime, Fibonacci, Armstrong logic
Matrices, Sorting, Factorials & more
Python pdf
❤5👏1
🚀 Free & Relevant Books for Data Science (2025) 📚
Want to sharpen your Python & DS skills without outdated material? Here are some modern, still-relevant free books 👇
1️⃣ Python Data Science Handbook – Jake VanderPlas
🔗 https://jakevdp.github.io/PythonDataScienceHandbook
Core libs: NumPy, Pandas, Matplotlib, Scikit-Learn. Updated + interactive notebooks.
2️⃣ Python for Data Analysis (3rd Ed.) – Wes McKinney
🔗 https://github.com/wesm/pydata-book
By the creator of Pandas. Modern data wrangling & cleaning.
3️⃣ Dive into Deep Learning (D2L.ai)
🔗 https://d2l.ai
Hands-on deep learning with PyTorch & TensorFlow. University-level, interactive.
4️⃣ Minimalist Data Wrangling with Python (2023) – Marek Gagolewski
🔗 https://arxiv.org/abs/2211.04630
Practical workflows for real-world messy data.
5️⃣ Machine Learning with PyTorch & Scikit-Learn – Raschka et al.
🔗 https://github.com/rasbt/machine-learning-book
End-to-end ML with clean, modern Python code.
✨ Start with VanderPlas & McKinney for core skills, then move to Raschka/D2L for ML.
Want to sharpen your Python & DS skills without outdated material? Here are some modern, still-relevant free books 👇
1️⃣ Python Data Science Handbook – Jake VanderPlas
🔗 https://jakevdp.github.io/PythonDataScienceHandbook
Core libs: NumPy, Pandas, Matplotlib, Scikit-Learn. Updated + interactive notebooks.
2️⃣ Python for Data Analysis (3rd Ed.) – Wes McKinney
🔗 https://github.com/wesm/pydata-book
By the creator of Pandas. Modern data wrangling & cleaning.
3️⃣ Dive into Deep Learning (D2L.ai)
🔗 https://d2l.ai
Hands-on deep learning with PyTorch & TensorFlow. University-level, interactive.
4️⃣ Minimalist Data Wrangling with Python (2023) – Marek Gagolewski
🔗 https://arxiv.org/abs/2211.04630
Practical workflows for real-world messy data.
5️⃣ Machine Learning with PyTorch & Scikit-Learn – Raschka et al.
🔗 https://github.com/rasbt/machine-learning-book
End-to-end ML with clean, modern Python code.
✨ Start with VanderPlas & McKinney for core skills, then move to Raschka/D2L for ML.
jakevdp.github.io
Python Data Science Handbook | Python Data Science Handbook
❤3