Today I want to propose a new habit for you which will ensure that you are on the path of continuous improvement in Python — on the path to mastery.
Did you read the book “The Power of Habit” by Charles Duhigg?
This Keystone Habit changed her life…
The Pulitzer-Price-winning author talks about forming so-called keystone habits that will change every area in your life.
Duhigg describes an unhealthy, unhappy, smoking, and heavy woman. This woman one day decided to start running every day.
Running daily was the keystone habit that caused a chain reaction of positive changes throughout different areas of her life.
She stopped smoking, started to eat healthier, became fit and confident, slept better, and planned for her first marathon. She also became more focused at work and more successful in her career.
Everything changed for the better. Only because of this one thing — running every day. It was like a domino effect: changing one thing caused a chain reaction in her life.
Challenge: Write one line of code every day.
If you want to become a master coder, I want to challenge you today
Implement one keystone habit which you will do every day for the rest of your life.
It’s a simple habit. But if you do this, your results will blow up. I started this habit two years ago, and since then, everything has changed for me.
I created my online learning platform Finxter.com which produces new Python experts daily.
The platform is implemented in pure Django with HTML/CSS/JavaScript on the front-end. Although I didn’t know much about these technologies, I quickly learned and mastered them because of my daily habit of writing one line of code every day.
I have a computer science degree and just came out of a doctoral research program in computer science so I have some background knowledge.
Nevertheless, these technologies were new to me, and I had to learn them just like everybody else.
My app attracts hundreds of thousands of coders online, and it keeps growing. And all of this is only because of my habit of coding at least one code line every day.
Indeed, I marked my calendar with a red ‘x’ if I finished the coding habit. And I ensured that the chain was never-ending.
No Excuses! You can always write one line of code — even if it’s just a comment.
If you calculate it, you’ll come with a mere 365 lines of code in a whole year. But this is far from what really happens.
In reality, this habit will cause you to write tens of thousands of lines of code every year just because of the physics involved: inertia.
If you write one line, it’s likely that you write another, and another. Ultimately, you will find yourself writing hundreds of lines of code every day.
So, as an ambitious coder, you may ask: why not implement the habit of writing 100 lines of code every day (instead of only one)?
Powerful Habits have low barriers
Because you’ll not push it through. The barrier is too high. Oftentimes, you’ll not open your code editor because you don’t feel like it’s possible to write 100 lines of code.
You’ll procrastinate.
Believe me, even if you are a disciplined person, set the threshold to one line of code every day. It’s simple and there is no excuse not to fulfill it. So you will fulfill it every day.
This keystone habit is easy but make no mistake: it will change your life! In a few years, you will reap rewards you’ve never dreamed of.
Are you up to the challenge?
Python One-Liners Book: Master the Single Line First!
Python programmers will improve their computer science skills with these useful one-liners.
Python One-Liners will teach you how to read and write “one-liners”: concise statements of useful functionality packed into a single line of code. You’ll learn how to systematically unpack and understand any line of Python code, and write eloquent, powerfully compressed Python like an expert.
The book’s five chapters cover (1) tips and tricks, (2) regular expressions, (3) machine learning, (4) core data science topics, and (5) useful algorithms.
Detailed explanations of one-liners introduce key computer science concepts and boost your coding and analytical skills. You’ll learn about advanced Python features such as list comprehension, slicing, lambda functions, regular expressions, map and reduce functions, and slice assignments.
You’ll also learn how to:
- Leverage data structures to solve real-world problems, like using Boolean indexing to find cities with above-average pollution
- Use NumPy basics such as array, shape, axis, type, broadcasting, advanced indexing, slicing, sorting, searching, aggregating, and statistics
- Calculate basic statistics of multidimensional data arrays and the K-Means algorithms for unsupervised learning
- Create more advanced regular expressions using grouping and named groups, negative lookaheads, escaped characters, whitespaces, character sets (and negative characters sets), and greedy/nongreedy operators
- Understand a wide range of computer science topics, including anagrams, palindromes, supersets, permutations, factorials, prime numbers, Fibonacci numbers, obfuscation, searching, and algorithmic sorting
By the end of the book, you’ll know how to write Python at its most refined, and create concise, beautiful pieces of “Python art” in merely a single line.