Refactoring example in Python

Refactoring (noun): a change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

Initial code

here is the initial code in Python:

Refactoring steps

Through refactoring, we change a lot of things with the code. I have done these steps again and again to reach our final refactored code:

Final Code

here is the final code:

Python Developer