I know the basics, but I still don't know how to write code

I’m currently taking a class for intro to Python. The lectures, I understand what’s being discussed. I understand the concepts that are being taught in the textbook. The code that is written as example demonstrating the concepts that we’ve just learned - I get them. So I’m feeling pretty good at this point.

However, when we get homework assignments and told to write code to answer the questions. I’m completely blank. I don’t even know where to start. It’s like writers block for coding? I just don’t know how to transfer the concepts I’ve learned into code. It’s super frustrating and is really the only thing hindering my development right now. It’s a hurdle I don’t know how to overcome. I don’t know if this is a common problem with beginners?

Really looking for any advice. I’ll take whatever pointers any of you have.

1 Like

Very common I would say, at least for people that come to the field with 0 programming background. How do you overcome this? After you think you’ve learned enough theory, go practice, code, build something. That’s where your going to know for sure whether or not you learned anything, if you not, don’t panic, you just have to re-learn the concepts again (perhaps from a different source) and keep pushing, eventually you will get it.

I remember when I finished my first JavaScript tutorial, I thought I knew JS, then I decided to start a project and I realized I didn’t know JS. But I kept practicing, building projects, reading/watching different tutorials and asking lots of question on this very forum until things started to make sense. It was a struggle, but today I can say I know how to use JS.

1 Like

This is very common if someone doesn’t have any prior experience doing something related to coding/programming. It seems you are a complete beginner. Just try to understand the question you are asked to solve and if you fail then search google. If you still don’t know how to solve that then ask a friend or ask here in the forum.
If the course you are pursuing is difficult for you then you may try the codeacademy for a moment then you may get back to the course or you may follow both parallelly.
Important: Don’t give up.

1 Like

Very common problem. Just keep struggling. Try different sources - books, blogs, youtube videos, etc. Just keep struggling and it will gradually make more and more sense. This isn’t easy. If it was, everyone would do it and it would pay minimum wage. But it is learnable.

2 Likes

what I did was I wrote down every single code snippet I saw, either from online tutorial or books, or on twitter.

if I saw someone wrote down some code in the language I am learning, I wrote it down. even it is a simple if else statement.
I did this to just get used to the syntax.

then once you’ve done that long enough, you gotta learn the basics. data types, how to store stuff in array, how to manipulate arrays etc.

then there is algorithms. it took me a while to understand the logic behind even simple/easy algorithms. but right now I feel that I am a lot more comfortable with it.

it takes time. also repetition keeps you green. don’t be ashamed of not understanding some code and wrote it down over and over again., I felt that’s the only way for you to get better.

1 Like

I remember how I started writing my very first line of code, which like many others, was the ‘hello world’ in Javascript.

First of all, I want to emphasize that the only way you’ll learn how to code is to ACTUALLY WRITE CODE (instead of just reading how to write code, or watching videos on how to write code).

For me, I started by doing the introduction to Javascript course on codecademy. I find that they ease you in with super duper simple code first, and after writing only one line of code, I could find out if I did it correctly or not. Try to start super small, declaring one variable, or console.log something (Python equivalent).

I hear Python is a very beginner friendly language to learn. As others have said, keep at it! For me, my main advice is take baby steps and actually write code. Gradually and slowly work towards writing more complex logic.

Believe me, EVERYBODY started as a beginner and struggled and got frustrated at how little they could code at some point before they became any good at it.

Just like when we first learned to write in English…remembering the letters, when to use capitals, punctuation, spelling, and even physically writing the letters so that they were legible was all difficult! And now look at us, communicating complex ideas on internet forums!

1 Like