I'm a college freshman with no previous coding experience. I started learning Python shortly before college, but I still feel uncomfortable writing programs. Now that my classes are teaching C, syntax such as i++ is getting mixed up with Python.
One assignment asked us to calculate sin(x) using the series x - x^3/3! + x^5/5! and so on, using loops. I couldn't figure out how to approach it in either language. My classmates had learned programming in school and seemed to consider this and similar problems standard.
More recently, I couldn't work out that printing multiplication tables required nested loops, and I also struggled with a Floyd's triangle exercise until I saw the solutions. I'm worried that I'm not developing the ability to recognize the approach on my own. What should I do to improve? Should I focus only on C for now, and how can I learn to break these problems down instead of immediately looking at the solution?
3 Answers
You are not behind just because you’re new. Programming problems often seem mysterious until you’ve seen the underlying pattern a few times. For the sine series, write out the first few terms by hand, identify what changes from one term to the next, then add one term per loop iteration. Test with a small value of x and compare the result with a calculator.
For nested loops, draw the desired output on paper first. Ask what the outer loop controls and what the inner loop repeats. For a multiplication table, the outer loop can select the row number while the inner loop multiplies that row by each column from 1 to 10.
For now, focus mainly on C since that is what your class uses. Work through very small exercises and ask about the exact step where your reasoning stops. Seeing a solution is not failure, but try to close it afterward and reproduce the program yourself.
It can help to make your own comparison sheet for C and Python. Record small concepts with examples, such as incrementing a variable: in either language you can write i = i + 1, while C also allows i++ or ++i. The two forms differ when the value of the expression is used, so learn that distinction, but don’t let shorthand distract you from the underlying logic.
If you know how to solve an exercise in Python, first write the algorithm there or in plain English, then translate it into C. If you cannot solve it in Python either, work it out on paper as instructions for another person. Writing this comparison sheet yourself will make the syntax differences easier to remember.
The main goal should be understanding the algorithm rather than memorizing every shortcut. Once the steps make sense, the C syntax can be looked up and practiced separately.
Write the solution in ordinary language before writing code. Don’t begin by guessing syntax. For example, describe a multiplication table as: choose a row, multiply that row by every column value, print the results, then move to the next row. Once the instructions are clear, loops become a way to repeat those instructions.

I often understand the explanation after seeing the solution, but I don’t know how to find the idea by myself. I’ll start with smaller exercises and try writing the steps down first.