# Anusha's Blog  # Building the muscle of writing code

I want to share a personal experience of how I always jump into writing the code first then course correct my way through the logic, and that would be so wrong to the whole thinking process. Not only it hinders my understanding of the problem statement but also dilutes the possibilities of me finding alternative or efficient ways of solving the same problem.

We need to first understand the problem fully and then navigate through the solution blocks, in right order of the stages. Just like a flow chart helps in the way of understanding the process flow, required parameters, inputs, calculations, conditions, exceptions and states, work your way through pseudo code in step wise approach as well.

Even before you start to build your logic in the code, evaluate what you are trying to derive and what is your starting point. Clearly lay out the input, expected output, and the associated patterns. Introduce the clauses, conditions, exceptions slowly.

There would be interesting challenges that would come along your way that logic you would otherwise use to solve a problem wouldn't be applicable the same way when you write the code. Here's a simple example of how I was trying to split a 3 digit number to represent them in the form of sum of hundreds, tens and units.

``````number = 547
print(" ", int(number/100)*100)
print("  ", int(number%100 - number%10))
print("   ", int(number - (int(number/100)*100) - int(number%100 - number%10)))
print("=", number)

print("*******************************************************")

number = str(number)
print(f"\t  {int(number)*100}")
print(f"\t   {int(number)*10}")
print(f"\t    {int(number)*1}")
print(f"\t= {int(number)}")
``````

While it doesn't make sense for me to code this way for a generic solution where the number of digits for a given number is not known to me, at least I know this won't work and scale as my scope of logic expands. Writing a code that works in any scenario is far better than writing any code that serves the purpose just for one given scenario. Isn't that also why in coding challenges -- you are always given the range in which your inputs lie, with time constraints.

The more you start to code, the more you familiarize yourself with the available inbuilt functions that you could leverage and learn efficient ways of writing code. There are always friendly forums to share and discuss your code in which other developers can guide you, challenge you, help you skill yourself better in terms of how to channelize and improvise your code. You'll only get better at the things you do more.

About building the muscle for coding, it is more towards regular code workout as I call it. Always encouraging your brain to build pseudo codes for any given problem, taking the granular path to the smallest fundamental unit. Once you have landed at your first element, you know where to start.

This has been my first blog here, hoping to write more, thank you for reading thus far.