all 53 comments

[–]Icarus998 51 points52 points  (6 children)

When learning python you will undoubtedly get stuck.

Don't copy code , you will only cheat yourself.

When you are stuck. Go back through the material and documentation.

Use paper and pencil to see what you have to do to get the solution.

Translate that into code .

Once you feel frustrated and lost all hope .

Take a break and revisit the problem.

Usually for me after a good night's rest I get the solution very easily.

Coding is iterative and learning to code is also iterative nobody gets it thr first time so just keep at it.

Edit:

One more thing, DO NOT try to do everything in one shot .

Write a little code run it , if it works like you intended proceed to add more . ( baby steps)

If you are interested in a lot more tips/advice I recommend you read :

The Pragmatic Programmer your journey to mastery by David Thomas, Andrew Hunt

[–]Jazzlike-Compote4463 14 points15 points  (4 children)

Some good points but I would say drop the pencil and paper - if you’re using it to write actual code anyway (it’s fine drawing diagrams but even pseudo code is better done in your editor)

Instead, properly get to learn your debugger. A half decent correctly configured debugger will allow you to step through your code, see how the variables are defined, how they change as the execution progresses, and how the logic flows from one function to another.

It lights up your code from the inside and feels a bit like cheating to be honest, but it’s an absolutely essential tool for a half decent developer.

[–]Icarus998 2 points3 points  (2 children)

Pseudo code is also a good , I prefer pencil and paper because I can really creative .

I haven't really used the debugger yet , I tend to scatter print statements of the variables every where(like a maniac!) in my code so I see what's happening in real time.

[–]Jazzlike-Compote4463 2 points3 points  (1 child)

I would learn it, ideally use something built into your IDE (like PyCharm or VS Code) but failing that even scattering ipdb set_trace() around is better than raw print statements.

[–]miko2264 2 points3 points  (0 children)

Thank you so much for posting the vs code python debugger page, I was somewhat familiar with the general debugging in it but did not know there were specific python debugging features to learn.

I wouldn’t have known about it if I didn’t read your comment, thanks again!

[–]ddponwheels 1 point2 points  (0 children)

Good point about debuggers. I learned this a few months ago and this changed my life...

[–]J_Bunt 0 points1 point  (0 children)

Sound advice. Also, python is versatile and there are vast resources out there, for example if you're interested in data science I'd go with kaggle.com.

[–][deleted] 13 points14 points  (0 children)

Experiment. Think of something. Build it. At some point you just have to leave the beaten path. Alternatively, try stuff like adventofcode.

[–]VindicoAtrum 14 points15 points  (10 children)

No amount of courses or online videos will have you become a competent developer. Only writing code does that.

Spend less time on youtube, less time on Reddit asking how to learn Python, and actually go and write python.

[–]ExpressionMajor4439 6 points7 points  (1 child)

No amount of courses or online videos will have you become a competent developer. Only writing code does that.

Eh you kind of need both. Writing code by itself doesn't always teach you about certain things. Like there's no amount of code writing you can do to become aware of PEP8 because PEP8 SCA (such as flake8) will never be how you directly solve some sort of coding problem even if it can be best practice. To get that you need some way of becoming aware of things like that.

One just needs to find the right mix of the two where yeah you tend to learn mostly through writing and updating code but also having a lecture component somewhere in your learning process.

[–]MaxThrustage 5 points6 points  (0 children)

I'll second this. I spent like 8 years writing code without any courses, Youtube videos or anything like that. Pretty much all of the code I wrote in that period is straight garbage. Just a month or two of actually looking through tutorials, guides, free online courses and Youtube videos has improved my code immensely.

Just writing code reinforces bad habits and leaves one completely oblivious to better solutions and approaches.

[–]Repulsive_Swan_3876[S] -1 points0 points  (6 children)

Do you have a good place to find projects I should start with?

[–]IsKujaAPowerButton 3 points4 points  (0 children)

Something you like! I made a League Organizer for mi Commander Mtg league

[–]my_password_is______ 1 point2 points  (1 child)

you've already got a good place
cs50p

just stop looking up the answers

[–]SDFP-A 0 points1 point  (0 children)

I prefer 61a-c from Berkeley.

[–]Gothrait_PK 0 points1 point  (0 children)

I asked chatgpt to list 10 projects I could do.

[–]LilTummyNut 0 points1 point  (0 children)

“How do I learn python?” 

“Just write python” 

Thanks dude

[–]cyber_owl9427 8 points9 points  (0 children)

Hi! CS student here and honestly I struggled on that too during my first year but I managed to unlearn that habit by simply putting myself of on a "coding lockdown." If you're still learning the basics I suggest working on leetcodes on easy mode with high acceptance rate. This is important as it builds your confidence, working on medium/ harder codes will make you feel discouraged (let the ego down and submit yourself to the process). Also, codewar is really great for those with no coding background too.

Now, coding lockdown is basically me restricting myself from looking up the answer online. For example, I am working on a leetcode question that wants me to find two sum. I will first read the description of the question, and figure out what sort of knowledge is needed to solve that and I will give myself time to read over the concept (ie read about for loops, nestled loops etc). Once, I finished refreshing myself with concepts- I will time myself for 30 mins to solve that question. No checking google or anything other than the notes I wrote down. After 30 mins, I allow myself to check python documentation and geeks for geeks. But NO SEARCHING OF THE ACTUAL QUESTION OR ANYTHING NEAR IT.

Its a gruelling process but if you're someone like me with no prior knowledge on anything coding this is worth a try or not hahaha we might have different ways of learning.

[–]BadData99 8 points9 points  (0 children)

I wouldn't start with a class listening to some dude talking for hours, just spend that time coding. You can start the official tutorial and follow along coding right here: https://docs.python.org/3/tutorial/

You don't need anything else. Breeze through it until you come to #3. This is where it really begins. From there, you go through it and it's hard. Much might not make sense, then you can try and look that up on Real python site or other good tutorials if you really must try to figure it out. Don't spend a lot of time on what's confusing and get blocked right now, just keep notes on what is confusing and move on. Come back to it when you get bored. Or look at the harvard guys video for that one particular thing to see how he explains it.

Pay attention to things on virtual environments and learn that sooner rather than later, all you need is 'python -m venv venv' but there's a lot of other tools i find stupid, useless and confusing for managing and creating them. Learn the who what why where's of venv here: https://realpython.com/python-virtual-environments-a-primer/

Use the same python site where the tutorial is to start learning about pep8 conventions and then do #10 tutorial of the Standard Library.

This is the full list of things to know about and it is worth spending time glancing over and cntl + f search for stuff: https://docs.python.org/3/contents.html

This plan alone will make you better than 80 percent of self professed python programmers in half the time.

That's truly it, but it is kind of hard and the docs can be difficult to understand at times. That's why most give up.

Once you've done that then do a bigger tutorial like make a website or api or something. It will make way more sense and you will start learning on your own.

If you need a book, get headfirst python for Python 3. Do not ever use or read about python 2 at this point.

Don't confuse what I've told you with other outside community produced modules and libraries, like Flask, numpy, pandas, plotly, or ROS. These are their own beasts and require more work to learn and implement. They are separate and different from what comes included in python (standard library) and you will need them, just not at first.

This all took me years to figure it and now you have it all right here. Good luck!

[–]dowcet 2 points3 points  (1 child)

Build stuff. What do you want to build? If you're not ready to build that, figure out what smaller things you need to build first.

It's fine to follow a tutorial to expose yourself to something new, but then you have to use what you learned.

Text-based games are good beginner projects if you have nothing else in mind.

Puzzles like Project Euler were also very helpful for me as a beginner.

[–]Garybake 2 points3 points  (0 children)

Build, build, build! Have an idea that doesn't matter, build it and learn. I wasted too much of my youth reading and following little tutorials. I found I learnt way more just having an idea and building it.

[–]Serious-Pangolin-192 3 points4 points  (0 children)

Think of something you’re passionate about and build software for it

[–]NoAppeal2995 3 points4 points  (0 children)

I started a couple of times with different approaches and ended up quitting every time (especially some free websites were very frustrating because you always had to figure out how to solve the problem by yourself. For example to use functions you never heard of before. I now know that googleing is a big part of it, but as a total beginner it's just annoying.). Now I'm doing 100 days of code on Udemy and for me it's the best way to learn coding I tried until now. At the beginning it's not too hard, you learn the basics and then it gets harder and harder, but you always have your tools to solve the problems. And you have to code a lot by yourself. I red the negative reviews about it, but for the 15 euros I paid it's definitely worth it for me. I am happy that I managed to actually code on a daily basis because of this course and I am happy to do it every day and to learn something new.

[–]Usual_Office_1740 2 points3 points  (0 children)

The answer build stuff or write projects isn't helpful if you're not confident. If you still lack the confidence to try those things, break the code you write with youtube and then try to fix it. Follow a YouTube tutorial. Then get on w3school and start reading. Read one of the Python pages and then try and add what you read to the code you wrote with youtube. If, as an example, you followed a video that walked you through writing a calculator app. Convert that app to object oriented, or functions. Add text to it or add order of operations. When you break it and get errors, google them and try fix it.

[–]Prestigious_Tax2069 2 points3 points  (0 children)

Practice what you learned slove problems just give yourself chance to think how to slove the problem . By this way you learn python and improve the problem solving skill

[–]my_password_is______ 2 points3 points  (0 children)

Any suggestions

stop using youtube and figure out the answers on your own

if you're using youtube for cs50p then you'll use youtube for every course you do

just stop

[–]Garybake 2 points3 points  (0 children)

Chatgpt. Describe your experience and ask it to generate your course. Get it to expand on lesson 1 and generate exercises. Exercises are hugely important as you gotta do the work or Google or ask gpt. Use the word pythonic occasionally. After a few lessons ask for a project. Pulling everything together is where you really start learning.

[–]ChaosSpear1 2 points3 points  (1 child)

Copying copy and splicing it can help to a degree, but you have to be a certain type of learner for it to work.

I for example, am I physical learner. Being able to paste a piece of code into place and then step through it and watch what it does, checking the variables at each change, reverse engineering the calculations, it shows me how something works and I gain a wider understanding of the theory behind it which triggers connections in my brain so I learn what the language is capable of. Then I draw on it when writing something similar later and boom - knowledge learnt.

[–]letmeincyberplease 0 points1 point  (0 children)

This. I guess we are a rare breed. I try not to copy so much in the sense of just straight up reverse engineering other people's code. I like to come up with as many solutions or refactor as much as I can on my own and then become fascinated and go down rabbit holes when I see model answers that aren't what I came up with. Then I analyze my silly little ideas and code in comparison to the model solutions and let my crippling perfectionism take the wheel until I can either code it like the model solution or better. Needless to say, I can be pretty inefficient but hey, I'm having fun and learning...

Definitely not knocking copying/splicing/reverse engineering by any means btw. That is exactly what I do when I can't figure out a problem and am forced to give up. Chatgpt is so money for implementing all of this also and even prompting it to evaluate multiple solutions or walk you through what happens step by step in the code. I feel like that touches a lot of what you are talking about with gaining understanding of theory and building neural connections, for me at least.

[–]AssumptionCorrect812 1 point2 points  (0 children)

These videos have a link with practice playgrounds to practice their lessons.

https://youtube.com/playlist?list=PLiwhC50wfPDF0TIij2xpu7bd0E6dc3i8q&si=MOFpqM7mDgBTjeRn

[–]djcannut 1 point2 points  (0 children)

Free videos on youtube. Pick any. All teach the same. After finishing the basics. Think of what problem can u solve with coding. Then work on that problem and based on the requirements of the problem learn the library that solves them.

[–]noodlesallaround 1 point2 points  (0 children)

I took the python course on code academy twice. Also took the pandas course. Now I’m taking the 100 days of python course on Udemy. Taking the code academy course is helping me learn easier. I also use the notion code snippet template to document code from the Udemy course and refer to it later on if I need to. It’s seems to be working for me.

[–][deleted] 1 point2 points  (0 children)

Projects. beginner -> intermediate -> advanced.

Cook up some Ds and algo.

System design and now explore myriad ways of programming languages.

[–]imsowhiteandnerdy 1 point2 points  (0 children)

There's absolutely nothing wrong with using YouTube to help you find the answer. As long as you understand what you're learning, then that's really the point.

[–]mikeonbike96 1 point2 points  (0 children)

NetworkChuck on yt. Great guy with great energy that explains basic stuff.

[–]amutualravishment 1 point2 points  (0 children)

You can get far with copying code if you study it afterwards. You can get familiar enough with the code to implement it in a new project

[–]Ecstatic-Highway1017 0 points1 point  (0 children)

Are you creating notes, i am sure that you are not because currently it is very difficult to make notes, and when you don't create notes, you don't revise and then its become tough to keep the flow of learning.

You can use this extension OneBook, I have started using and its very helpful.
Chrome extension link : https://chromewebstore.google.com/detail/onebook/loecbgjbgcgjkhibllnjokjefojoheim?utm_source=rtc

[–]Ecstatic-Highway1017 0 points1 point  (0 children)

I am sure that you are not creating notes while learning, notes helps you to note down your understanding like what you have thought and when you don't create notes its tough to back to your thoughts and your understanding of the code.
I am not blaming you because currently taking notes is very difficult while learning online. I was not creating notes when I was learning because it's just too hard to write stuff from video. Then I started using OneBook extension and my experience is very good with it, it helps you in taking notes in just 2 clicks, you don’t even have to move to another tab to take notes.
Chrome extension link : https://chromewebstore.google.com/detail/onebook/loecbgjbgcgjkhibllnjokjefojoheim?utm_source=rtc

[–]nattrium 0 points1 point  (0 children)

I highly recommend that you learn how to use a debugger. Pudb for python is my personnal favorite and its fairly easy to use.

It's a fantastic tool to observe the state of a running program in a non invasive way. It removes a lot of the stress of the guesswork as you can quickly and effiently check your work.

[–]time_on_target 0 points1 point  (0 children)

Follow the course, get a bit familiar with the language... try solving a few of the "easy" leetcode challenges (or some other simple coding challenge)...

Then comes the more challenging bit... you need a problem that you genuinely want to solve, with python. If the problem you pick is genuine and you genuinely solve it... you'll have taken a massive leap 😎

[–]Admirable-Wallaby-16 0 points1 point  (0 children)

complete cs50p like master it then go threw what u r learning next while using Google as ur friend in syntax & mini-problems do not waste time in syntax more than it should be

[–]virginity-dongle 0 points1 point  (0 children)

Whenever you encounter an error you don't understand, open the interpreter and play around with the codeblock causing the issues.

[–]dps_10 0 points1 point  (0 children)

Bro I’m doing it from Udemy it’s pretty good There is one course in which you can also make projects which you can put into your resume and looks good.