The Startup
Published in

The Startup

Month 13 — Practicing Python With CheckIO

This month has been a reasonably a low-effort on programming. After a lot of time spent learning a lot of technologies in the last 1 year, I have decided to slow down and master a few technologies. The first one is gonna be Python.

So, I have ordered a few books on Python, the most important one being

I have gone through this book in the first few months of learning Python and found it to be very difficult to comprehend. Let me see how I feel about the book this time.

I have also started visiting CheckIO dailly and solving the problems there. As I mentioned in week 1 update post, I love CheckIO for its ‘Best solutions’ feature — giving me a chance to see how other people have solved the same problem. About a year back, I could not even understand many of these top-rated solutions. But in the recent days, the solutions that I come up as my first attempt are very-close to the best solutions. This gives me a good feeling as the ideas that I have seen in these solutions have permeated my thought process. I want to document how I have made the switch, as I have seen many people asking the same questions when they see a very impressive concise solution — “How do I get to write code like this in python? Where did you learn these ideas?”. I had the same question too when I was new.

I used the excellent ideas from Derek Sivers in his article on SRS.

When I see some impressive aspect of a solution, I want to write a question in Anki that would help me to recall this aspect later. I want to capture a few example from my Anki decks to make this concrete.

Here, the Front side of the Flashcard has an extract from the code I have written to solve the problem. Then, I saw the more elegant and more readable version used by someone else — so, I created a question. Now, each time Anki throws up this question, I open VScode and the file “” and type the actual code in — then, I compare my code to what is written on the backside. This way, I am actively recalling the ideas many times over the next few weeks. This has led to some of the ideas getting more familiar over time, and some ideas even become a natural part of my thinking.

Here is another one — I saw someone use a walrus operator introduced in Python 3.8 and I wanted to master its syntax with a live example:

Now, in the solution that I have submitted yesterday for a problem, I have used the assignment expression, without thinking much about it. If I have read it only once, I guess I might have forgotten it easily and it would not have become a part of me.

Here is another question on avoiding try/catch. Since I have a Java background, I used a try-catch block to solve the problem, even though I feel that try-catch blocks are ugly. When I saw someone solving the same problems without try-catch blocks, I jumped on it:

For the same problem, there are many solutions that are often very good. So, I decide to create a question each for each solution I like. Here is a sample problem

It is a very simple problem — I need to make the first element the last element in a list. So, here is the first-version of the code I have written:

And here are 3 flashcards I have created. Note that I am prompting myself to write a different solution each time:

Here, I am asking myself to modify the list in place, rather than creating a new list using the slicing operator. Though I knew both append and pop, this solution did not even occur to me.

This solution uses slicing, but is much more concise than my first solution. I wanted to write something like this, but did not really know how to get a list when I am slicing a single element — I found the answer here. Hence, I wanted to memorize it.

Here, I got to know a new data structure in the collections module. I looked it up and read a bit to understand it. Then, I wrote this question.

Sometimes, when the answer is quite difficult for me to understand and I spend a bit of time to really understand it, I created a question to recreate the struggle — this involves finding the value nearest to given input in a list.

That is all — I hope this has given you a good idea of how I am using the SRS technique to learn from the best solutions I see in CheckIO.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Siraj Samsudeen

Siraj Samsudeen

An entrepreneur who is coming back to coding after a gap of 16 years due to love of coding.