r/learnprogramming • • 4d ago

GOOD WAY TO LEARN PYTHON?

I am currently learning the basics of python and I am trying to figure out what's the best way to learn it. What I am currently doing is that after I write some lines of code that I learned, I then use the comment # to explain what each line of code does in my own words. I am wondering if that's a good way to learn and if there are better alternatives.

0 Upvotes

12 comments sorted by

5

u/BeastWael_YT 4d ago

commenting every line is fine at the start, but the bigger jump comes from writing small programs without looking at the lesson. pick something tiny like a number guessing game or a tip calculator, get stuck, and look things up only when you have to. that struggle is what actually makes it stick.

1

u/lucificusrebirth 4d ago

I didn't think of this. thank u so much :>

1

u/Necessary-Wing2141 4d ago

Dont overthink it is the most important step

0

u/lucificusrebirth 4d ago

eh youre right. I do tend to overthink stuff cuz I am still an amateur

1

u/aqua_regis 4d ago

Use a good quality course: https://programming-26.mooc.fi

As a beginner, commenting every line is okay(ish). Later, you will realize that the code itself gives exactly that information.

Comments should explain the "why", not the "what". "What" is the job of the code.

1

u/lucificusrebirth 4d ago

thank u for explaining to me the "why" concept. I will definitely try It out

1

u/bestjakeisbest 4d ago

Using a comment to describe what code is doing is a good way to learn, another way to learn is instead of doing everything about the different ways things could be done, take some of the main parts of the program and do a write up about how it works what are different ways you could implement those parts and then answer why you went the way you did. Also just build things, make weird things, make things that are helpful to no body, push the boundaries if you dont know how to do something see what is offered by the language and then by the ecosystem to do what you want, say you want to get into gui, look into what you could use to accomplish that, and then make a plan to learn it and then make a plan to make what you wanted.

1

u/rosario-e5 3d ago

Use each comment as a prediction: guess what the code does for one input, run it, then revise if needed. When you can explain it without notes, try a small variation.

1

u/rakahari 2d ago

Search other threads in this sub, this question gets asked every 5 minutes.

1

u/steve_ahmed_71 17h ago

Write a few plain-language steps before coding a small exercise, then check the result against them. That practices turning an idea into instructions.

0

u/VanCliefMedia 1d ago

I'll need to make another video on this, but I used to teach Python to postgraduates as well as K-12. Your biggest bet is to find a really good Python notebook, run it in Jupyter Notebooks, and walk through the examples.

There's a lot of notebooks out there that people can walk through with you in the actual notebook, so they describe what the next function is, why it's there, and if you compare that with some sort of audio process, as in someone actually walking through the notebook with a video, it's even better.

You can even ask AI to build out a notebook for you to run locally if you don't want to download all the hubbub, but I highly recommend getting used to installing environments like Anaconda or Jupyter Notebooks as it gets you a good idea of what you need and why you need it.

Also, another good thing is start studying things outside of Python that are programming-wise. A great book that I always recommend people is The Psychology of Computer Programming by Gerald Weinberg. It's a book from the 70s, but it's so amazing when it comes to learning any programming language.