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!
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com. He’s author of the popular programming book Python One-Liners (NoStarch 2020), coauthor of the Coffee Break Python series of self-published books, computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.