Python is just the language for you. The smart way to learn Python is by practicing more programs in Python. In this series, we are going to write more and more programs to get clarity over a concept. At the end of the series, we will be ready for production quality code experience and we will try to cover most aspects of the readiness.

This is part 1 of the series, where we will focus on how to start and learn the basics or fundamentals of Python. All the courses that we will discuss are free and are some of the best course to learn and digest Python easily. Practice as much as you can and follow the steps like writing code, failing, analyzing, fixing it, writing it again, and so on. So by practicing writing more pythonic code, we will learn more and get a hands-on experience for developing production-ready code.

Warning: These are not the best performant programs. There may be better than these. 


In systems design, a fail-fast system is one which immediately reports at its interface any condition that is likely to indicate a failure. Fail-fast systems are usually designed to stop normal operation rather than attempt to continue a possibly flawed process. [wiki]

” In theory, theory and practice are the same. In practice, they are not. ” Dr. Albert Einstein

Let’s see where to start, what IDE to use, where to learn and learn for free.

We are not going to repeat the fundamentals; you can read it yourself. There are plenty of blogs and tutorials available for learning Python. In this series, we will write a few programs to prove that the concepts work.

After learning the first few sessions of Python and becoming comfortable with the programming construct, let’s jump to a few programs (in no specific order).


Return number of days in a month where the year and month is given.

Here we are also checking if the given year is a leap year or not. 

You will note we are using list, if condition, function, comments, and a few operators of Python.


How many times a letter is repeated in a given string.

We are using a library and have imported it (

A Counter is a dict subclass for counting hashable objects. (��from )


Prime number test. We are using the for loop here and the catch is there is one else statement in python for loop as well. 

When used with a loop, the else clause has more in common with the else clause of a try statement than it does with that of if statements: a try statement’s else clause runs when no exception occurs, and a loop’s else clause runs when no break occurs (��from )


Remember in school, the teacher used to ask us to write a line 10 times. The perfect solution is here. You can also use the range keyword to achieve this; try that at home (no risk).


List comprehension

It is more like a power pack in a single line of python and a better and concise way to use a list. Sometimes it is less efficient and harder to read, so use it when you think you are better at this.

For your homework – Is this better at readability than a lambda? 

In the next part, we will write more programs and explore more features of Python. Once you read a concept here, go back and learn it from the resources and write a program of your own and check in to your git. You are done for the day: add a point for yourself, a diamond point


A Few More Challenges

Keep smiling and keep learning.

Source link

Write A Comment