Learning Python Week 12 — Practicing mode

Siraj Samsudeen
4 min readJan 21, 2020

This week, my focus was to practice what I have learnt over the last few weeks. Hence, I decided to do one problem per day on CheckIO. When I started learning Python, I solved about 3 problems in Home station and then stopped going to CheckIO as I felt that I should learn more python before attempting more problems.

[Home — python coding challenges — Py.CheckiO](https://py.checkio.org/station/home/)

So, I went back to the 3 problems I had solved earlier and see whether there are things that I can improve and I did find a number of things to improve. Also, I wanted to review the best solutions written by python pros and see whether I understand them all — despite all the new knowledge acquired in the last 2 months, I was humbled to realize that there are many solutions that I still don’t understand. But I want to see this in a positive light — that the road to mastery is long and that I have many more milestones to cross. On the positive side, I am able to understand 80% of the solutions which is a great improvement.

A few days in the week, I spent almost 2 hours per day on CheckIO solving problems and reading others’ solutions in a state of flow — completely unaware of the passage of time and in a blissful state of alertness. If you want to understand more about ‘being in flow’, please check this out

[8 Ways To Create Flow According to Mihaly Csikszentmihalyi +TED Talk](https://positivepsychology.com/mihaly-csikszentmihalyi-father-of-flow/)

I also spent quite a bit of time on Stackoverflow this week — here are posts I have found quite useful:

[python — Is there any single function to print iterables values — Stack Overflow](https://stackoverflow.com/questions/15015452/is-there-any-single-function-to-print-iterables-values)

[python — What does the “yield” keyword do? — Stack Overflow](https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do)

Though I have learnt about list comprehensions earlier, still I did not feel fully at home and this video was quite helpful with very nice and clear examples about list comprehensions, set and dictionary comprehensions and generator functions. Combined with the knowledge of how yield works in python works, understanding generator functions gave me a lot of joy.

[Tutorial: List Comprehensions in Python — YouTube](https://www.youtube.com/watch?v=pShL9DCSIUw)

This week, I spent a lot more time with my 12-year old son who is also learning Python with me — we are both tackling one problem a day in CheckIO. I am teaching him the process of programming — how not to jump to writing code in an editor, but to start with paper and pen to do the following:

  1. Write a brief summary of the problem
  2. Generate at least 2 sample values for testing (one positive and one negative case)
  3. Write an algorithm using plain english language
  4. Run through the algorithm on paper using both positive and negative test-cases,
  5. Take each part of the algorithm and to translate it into python on paper
  6. If there are parts of algorithm for which he does not know how to get it done in python, use iPython or Jupyter notebook to experiment and get that part working
  7. Then, open Jupyter to write each part of the algorithm and test it interactively
  8. Then, convert the script into function and test it using all the test-cases given by CheckIO.

It has been quite an experience to go back and relive my earlier days of programming when I was grappling with the concepts of programming in my 2nd year of engineering. I have learnt this approach to thinking and coding on paper from my Computer Science professor when he taught us Fortran, C and C++. Then, I have perfected the approach when I worked with some inspiring colleagues in my first job as a Java developer. Not only this approach helped me to write better quality code, but also to be more thorough and diligent in other areas of my professional life which does not have any programming component at all. I can confidently say that learning to program better has helped me do everything better.

Here is my active learning log for this week — 2 new problems in CheckIO along with a question in Stackoverflow:

[Time Converter (24h to 12h) — python coding challenges — Py.CheckiO](https://py.checkio.org/en/mission/time-converter-24h-to-12h/)

[Non-unique Elements — python coding challenges — Py.CheckiO](https://py.checkio.org/en/mission/non-unique-elements/)

[python — How to schedule a py program on Mac to run every 60 minutes (under a specific folder) — Super User](https://superuser.com/questions/1518378/how-to-schedule-a-py-program-on-mac-to-run-every-60-minutes-under-a-specific-fo)

So far, a blissful and enjoyable week. And I am grateful to be back together with my object of love — programming :)

--

--

Siraj Samsudeen

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