Yet, most large code projects contain a lot of them! (Many coders use lambda functions as GUI callbacks, etc.)
In this “Coffee Break Python” email series, we take a pragmatic approach regarding Python code style — living in the “is” rather than in the “should be” world.
Can you solve the following puzzle about lambda functions?
# Python Puzzle fs = [ lambda x: x + 1, lambda x: x + x, lambda x: x * x, ] n = 0 for f in fs: n = f(n) print(n)
What’s the output of this code puzzle?
“Know Thyself and You Will Know the Universe”. 👴
You need to know your Python skills before you can start improving them.
A puzzle a day to learn, code, and play…
As a Finxter premium member, your Python skills will soar:
- Unlimited Python puzzles
- Track your Python skill level over time
- Free courses on the Finxter Computer Science Academy:
- [Course] Object-oriented Python
- [Course] Intro to NumPy
- [Course] 10 Machine Learning Algorithms
- [Course] Python Crash Course
- Free printable Python certificates to proof your skills to your employer or your clients.
Accelerate your Python skills now with the proven approach of puzzle-based learning!