Turning a problem into a working program is a process, not a single leap. A disciplined approach moves from understanding the problem, to designing a solution, to implementing it, and finally to testing and debugging it. Skipping the early stages almost always produces buggy, hard-to-fix code.
The first step is to state clearly what the program must do using the IPO model: Inputs (the data the program receives), Processes (the calculations and decisions performed on that data), and Outputs (the results produced). For a program that grades a test, the input might be a mark out of 100, the process is comparing the mark against grade boundaries, and the output is a letter grade. Writing the IPO down before coding prevents the common mistake of building