Pieces of Py #2: Use a dictionary instead of multiple if-statements

Posted on Thu 01 August 2019 in Python • Tagged with Python, Pieces of Py, Dictionary, Lambda, Functools • 4 min read

One thing I learned during my first #100DaysOfCode was to use a dict instead of numerous if-statements. In my opinion it can make the code much more readable among other things. Here I'll try to make an example where this concept could fit in.

In this example we create a …

Continue reading