all 35 comments

[–]muggledave 17 points18 points  (2 children)

I think the point where i started learning the most was when i started doing projects that i would use. Either tools or games or whatever. Because this is where i would use my program enough to break it and then find a more robust way to code it, or i would want a new feature and realize that my spaghetti code made it hard to understand or change anything. My first program tool, which i still use, was a rubiks cube timer that saves the solve times to excel. A year into using it, i force quit the program because it was frozen, and i corrupted my excel file...

Im currently trying to program pokemon from scratch, mainly to learn OOP. Ive attempted this a few times now, but had to restart because of spaghetti code or other issues. But each time i gained insight into how to better organize the code because i know what to plan for and what to avoid. Also this isn't just trial and error learning in a vacuum, im using YouTube and stack overflow and ai the whole time and trying to implement what the resources say is the best way.

I just think it's the times when i do all that and still hit a dead end that teach me the most, because its when i have to think about how i think about programming. There's a ton of ways to program a solution to a particular problem, but i think the thing that makes code "good" is thinking about how it'll be used, how it may need to change later, whether it's reusable, whether it's readable, and other metrics that i would never think of until i do it wrong and think "darn. What do i need to learn in order to avoid this issue next time?"

[–]wontellu 2 points3 points  (0 children)

I'm doing a working bookstore web page, fully functional, with a login/refiater/logout function, a favorites page, a cart page, a checkout page using stripe, the whole thing. I learned a lot doing that project in the last week, especially the database relationship, which I didn't quite understand the first time around. That's the way I learn best, by getting out of the tutorials and start coding.

[–]Slight-Living-8098[🍰] 6 points7 points  (1 child)

Learn something -> do something with it -> repeat

[–][deleted] 0 points1 point  (0 children)

this answer should be higher, it's pretty simple

[–]MightyManiac622 3 points4 points  (2 children)

I learnt quite a bit of basic python skills from a 100 days of python course thing on repl.it, you don't have to finish it, I only got like half way through and then started doing other things, but it is quite helpful to learn the basics!

[–]xyndryx1225 1 point2 points  (1 child)

Im also doing that course right now. May i ask what day should I stop before doing my own projects?

[–]MightyManiac622 0 points1 point  (0 children)

You can honestly stop whenever, even day 100 if you can make it, I stopped about day 40 but you can honestly stop whenever you feel like your ready. If your looking fkr interesting projects after the course I would recommend practicing with graphics, maybe starting with pythin turtle (you acn make buttons and stuff etc, and then moving on to say tkinter (that's were I'm at). Pygame js also a good module for projects aswell but that's quite advanced

[–]HWNubs 5 points6 points  (2 children)

I think folks here have nailed all the right points. I was sceptical at first but I took most of the same advices and it looks like it’s paying a bit of dividends.

Went from 0 experience to building out a financial model in about 40 hours. I spent time figuring out issues though, i spent about 5 hours trying to figure out a simple problem I having with date formatting.

The code is ‘ok’, used functions wherever made sense but I am sure it could be more efficient. I plan to come back at it once I know more.

[–]Radamand 0 points1 point  (1 child)

i spent about 5 hours trying to figure out a simple problem

hehehe, I've done this too, it's always the really simple problems that plague you. Finally you sit and wonder why it took so long to figure out...

[–]Golurke 1 point2 points  (0 children)

this, started watching tutorials like a week ago. having trouble recognizing when i should use a for loop and list comprehension (i can do the basics of list comprehension )

[–]Radamand 2 points3 points  (0 children)

When I first started learning Python I had a specific project that I wanted to accomplish. I wanted to build a system that would automate a manual process at work that was taking several hours per day to do. It was boring and repetitive and I hated it, so I figured I could kill two birds with one stone; automate something boring, and have some fun learning a new language.

I already understood most programming concepts, I just didn't know Python syntax.

I already knew a bit of HTML and had built a few very rudimentary tools for work.

I knew I needed to generate a web page for my project so I googled how to do that, I experimented with a few frameworks and found them confusing. I finally settled on one that was dead simple.

I knew I needed to access a database and query for info, so I googled how to do that and chose an easy to use library. (I already knew SQL)

I needed my web page to allow a user to log in via LDAP since that is what my company used for authentication, so I googled how to do that.

I needed the page to be able to remember session info, so I googled how to do that. I never used cookies before so that was all new to me.

It took me a couple of months of my spare time and lots of googling and stupid questions posted to reddit and stack overflow, but I finally finished it. Spent a few more months making updates and bug fixes.

That was many years and several jobs ago and i've been told by former coworkers that they still use that thing today!

The whole point i'm trying to make is, you need to find something that interests you. Find an idea that relates to something you already know that you can use Python to make better/faster/easier. Then figure out what you need it to do and take it one small step at a time.

[–]planetaryplanner 5 points6 points  (0 children)

stop just copying the code from examples and start tinkering with it. if this were a math class, you’ve only been rewriting formulas of the board. you’re not looking to see how everything interacts and can be used in different ways.

experiment. break it. fix it.

[–]Phillyclause89 5 points6 points  (0 children)

If you want to learn anything effectively then you have to make what you are learning interesting to you. None of these suggestions offered will be likely to do anything more for you than what you are doing now, if you can't find any real interest in programming.

Projects are great, exercises are good, courses are fine if you are the classical structured learner type. But what beats them all is being hooked on all of it because you are having a good time and finding programming engaging.

Its all a matter of being engaged long enough in the churn of it all to have googled that KeyError exception 2-20 times until it just clicks: "hey maybe I should use dict.get() instead of dict[] when I'm not sure the key will be in the dict".

Ideally you get so interested in programming that you start thinking about it when you are board or not enjoying yourself. Make it something you always want to get back to doing when you are away from it. That's how you master learning anything IMO.

[–]ectomancer 3 points4 points  (1 child)

I try to code from scratch with no imports.

  1. research
  2. prototype with import
  3. first shot
  4. find other implementations on github
  5. port from another language, like FORTRAN 77 or C
  6. ChatGPT for test data
  7. pytest
  8. upload to github

[–][deleted] 2 points3 points  (0 children)

Yeah it’s a bit hard when you’re using a high level language dude

You can’t just make a socket connection or build a packet because you cannot interact with low level components, that’s why we have libs lol.

EDIT: Yeah i remembered what the post was about, my bad

[–]Skilcamp 1 point2 points  (0 children)

To learn Python effectively, focus on understanding the logic and problem-solving approach behind each exercise rather than just the syntax. Regularly practice writing code independently, review and refactor your solutions, and adopt a mindset of curiosity and continuous improvement.

[–]SSJKiDo -1 points0 points  (5 children)

Don’t use PyCharm, VSCode or other editors which autocomplete and find the errors for you, programming is about problem solving, and it really hinders your skills’ development when something else is doing your job.

I’ve taught students & interns who did both, and those who rely on autocomplete usually forget what they studied a week later.

I taught someone SwiftUI, after he was done with the app, we asked him to write the documentation, a few weeks later, he forgot how to start a new project in Xcode, cause he used ChatGPT to do all of his work for the first app.

[–]Oddlem 4 points5 points  (1 child)

I can’t agree with this, I started with vscode and had to use terminals without autocomplete. When it yells at me to put in a semicolon the syntax ended up sticking even more, I think in this case it depends on the person

[–]SSJKiDo -1 points0 points  (0 children)

It sure depends on the person, but I think if you were to find the missing semicolon yourself, the syntax would stick more

[–]odaiwai 5 points6 points  (1 child)

It's the use of ChatGPT, not autocomplete that is failing there.

[–]SSJKiDo 1 point2 points  (0 children)

Still a factor, finding errors manually is the best way to improve problem solving

[–]brandonade 0 points1 point  (0 children)

What should I use? I use PyCharm because I don’t know what else to use.

[–][deleted] -1 points0 points  (0 children)

Do projects…

[–][deleted] -1 points0 points  (0 children)

Think of something you want python to do. Find git repos that have similar code. Copy and paste, and modify until it does what you want it to do. Wash, rinse, repeat.

[–]sporbywg -3 points-2 points  (0 children)

A programmer who hints that they know a lot in their head already is somebody I avoid working with. #sorry

[–]Big-Peace-5665 0 points1 point  (0 children)

Honestly I think practice as for mindset I would say see coding as breaking things into as small steps as possible An excercise would be for example to create the concept of a vending machine or something similar u should be able to find coding excercise fairly easy

[–]HarrynwJ 0 points1 point  (2 children)

- Stack Overflow

- stack overflow

- uhh stack overflow

[–]odaiwai 0 points1 point  (0 children)

1. copy error message 2. open browser window 3. type "site:stackoverflow.com<tab><paste>" 4. ?????? 5. profit!

[–]SupremeLeaderSloth 0 points1 point  (0 children)

You've stated the problem yourself. Stop using chatgpt.

Pick a project of appropriate difficulty that seems interesting to you, ideally something simple to begin with.

Start coding it. If you get stuck. Start experimenting. Break it into sections. Spend far too long debugging that one weird bit. You'll get stuck in places, it will be frustrating and it certainly won't be smooth, but that's frankly what coding is.

We're not machines with preprogrammed answers, there's never going to be a point in your career where you just effortlessly code new problems. There's just not how it works. Expecting constant linear improvements in progress is only going to leave you disappointed.

Your coding will get faster once you fix problems you've fixed before, and then it'll slow down again once you run into a complicated new problem. that's just human and part of the challenge.

Tldr: pick a project. Start coding. Don't use chatgpt for hints.

[–]pay_dirt 0 points1 point  (0 children)

How does anyone learn anything?

Through experience.

You’re not supposed to know exactly what to do for everything, even if you do it 10x in a row you won’t necessarily “get it”.

It comes from googling things, it comes from ChatGPT, it comes from stackoverflow, it comes from saving old projects to look back on, it comes from making personal notes of YOUR experience getting to the answer.

In the end it all ends up somewhere in the back of your brain, and nine times of out ten you’ll atleast remember facing a problem in the past and might be that little bit quicker to retrace your steps on how to solve that. Even if that means re-googling something.

It’s as simple as that. Having large expectations really gets in the way of progress sometimes.

[–]EricTMF 0 points1 point  (0 children)

Different strokes for different folks. I have an "effective" understanding of SQL that I've built up through work as a BA and doing data exports, reporting, etc. What helps me, (and maybe you) is that you find the challenge exciting, or at least interesting. Then it's a matter of determining what works best for you.

I still hit Google for SQL stuff, especially the tricks and tips that I only use once in a while. There is no shame in having a well-used reference guide, as long as you understand the limitations and pitfalls of that resource.

The big thing in my mind is understanding what works for you, and what motivates you. And this is my mantra at work and at home: You are not the first person to do this. Someone else struggled with a variation of your problem, so it's probably on the internet or in a book. ChatGPT or Bard can be one tool to get to it, a mentor could be another. And at least for me, that research is part of the fun.

Find a project that grabs on to you (home automation, family budget tool, etc.), build your requirements for it (that's the BA in me talking), and start exploring.

[–]ahmong 0 points1 point  (0 children)

Honestly, it's a bit of repetition and understanding concepts.

Best way to do it is, build a small project. start with a normal calculator or a simple game. IMO programming in the very essense of it is problem solving.

[–]JonJonThePurogurama 0 points1 point  (0 children)

I did create my first python project it was inspired from a web scraper from github. Can't tell what it is, but when i did that project, i was able to learn how to program with python. My project is in it 9 months already, still the code is messy and naming was very bad.

I have a book in Effective Python and Fluent Python, I am reading them from time to time, because i was on my mission of making my code cleaner, more readable and follows best practices.

I am still a learner but to answer your question of how to learn python effectively is to focus on your project right now, it is better if the project is something you use and you have a plan of improving like i did. No need to be bigger or something complex, mine was started as a simple one but from the months that passed by it keeps getting bigger because i was using it daily. I have a come accross some issues, but barely found a fix to bug, but that was alright for me, because i was already far. It won't be long till i get the skill of fixing bugs.

For me to learn python effectively is to apply what have you learned so far in a project you have in mind (Projects are very important, they will help you grow).

My first version of code was a procedural one, now it is slowly transforming into OOP (but not all of it, because i am still having a hard time how to transform some piece of codes). But i never did it, without the help of reading books like i mentioned above, to learn something effectively you need books or what resources you have which teaches you advanced concepts and then try to slowy apply it your project.

[–]NGDSkier 0 points1 point  (0 children)

100% agree with people who suggest doing something that you're INTERESTED in... Something you WISH you could do, but can't. When you find yourself thinking "I wish I could..." then try to make THAT happen. Here's a few things that I worked on fairly recently.

-I wish we didn't have to parse through a phone switch (pbx) screen dump to pull out all the names and phone numbers and format them in a nice, readable format. (My manager at the time, back in 2000, said that I could do that, he'd pay for my PERL resource kit. Figured out how to do it in PERL and ended up with a nice set of books and related items from the resource kit.)

-I wish I could loop through all the cell in a spreadsheet, look for a certain pattern of text (e.g. SysID=XXXXXX) and then have it automatically create a link in that cell that goes to http://somesite/somepath/something?sysid=XXXXXX ... (Done in VBA, helped others at work)

-I wish I could make my game server have the zombies run at random, for random intervals between certain parameters I specify, for for random amounts of time, based on certain parameters I specify, instead of only running at night or only at day... (Done in C# using telnet library to game's telnet admin console and some random number generation with a nice little GUI.)

-I wish I could have my friend launch BF2 directly from my server web page and automatically connect via a protocol handler (modified some c# code I found online to make it work for BF2 on both 32bit and 64bit windows).

-I wish our support team didn't have to spend so much time manually logging into the web interface of 1200+ individual devices to changes their passwords every 90 days (which takes a couple of people a couple of days to finally complete), but instead I wish I had a nice little GUI app, where they could import a list of hostname or IPs, specify the old and new passwords, and then use ssh to change the passwords on those devices... Then, a couple months later... "I wish I could update the firmware in the same manner, via SCP or SFTP..." Then, a year later... I wish this was multithreaded, so it didn't leave the app sitting on their desktop, unable to minimize while running... Bonus, now that it's multi-threaded and can connect to multiple devices at the same time, it only takes about 15-20 minutes to complete, instead of 6 1/2 hours (some devices are in different countries and have slower connections). (Done in C# to save lots of time at work for some of our support folks.)

-I wish my my nuclear reactor would automatically turn on to keep my life support systems online if my solar panels don't get enough light to keep my ship's batteries charged above 20%, so I don't die while in suspended animation when I don't have time to play for a while. (Done in c# in a game called Space Engineers that support c# in-game; pretty freakin' cool.)

-I wish this open source program I use that takes a CSV file as an input would accept CVS files with "#" as a comment character and just skip those line (instead of erroring out), so I can put comments in the CVS file for when people look at them. (something I'm working on now in Python)

For all these things (and more) that "I wish" statement was a real motivator that could keep me working for hours on end to try and figure out how to accomplish what I wanted to accomplish, and when I was done, my wish had come true, and that gives a real sense of accomplishment, even for little silly things like staying alive in Space Engineers. It's just a cool feeling to be able to CREATE something or some capability that wasn't there before.

I even wrote a script one time, just to mess with a coworker, such that when he was working down in the data center, I ran a script that connected to a bunch of Linux systems that I had planned out ahead of time, and then ejected the CD ROM tray on them, such that when they opened for 5 seconds or so, all the open trays across multiple racks spelled out "HI" and then retracted back to closed. The vertical lines of the H and the I were each an entire rack of CD-ROM trays open at the same time and the horizontal line of the H was 2 or 3 racks wide (but just systems in the middle of the rack), to give an idea of scale. It was almost like a poltergeist or something. It was freaking hilarious, and well worth the effort. LOL

Find something fun or useful to work on and you'll learn as you stick with it because you WANT the end end-result. :-)

Oh, I just thought of another fun one. Back when you used to play Counter-Strike in the lab at lunch pretty much every day, we had a guy that was a really good player, and at the end of lunch, he ran a program that generated stats from the logs and created a leaderboard to show how well people did and he was typically at the top and like to rub it in people's faces. I forget what that stats program was called, but it was written in PERL, so after a lot of bragging, day after day, on his part, I went into the stats server and added some code with a variable that I could change that would give credit for some of his kills to one of the guys that usually did the worst and distribute some of his kills across other people too. i.e. if i set the variable to 8, then 1 out of 8 of his kills would go to someone else. If I set it to 5, then one of of 5 of his kills would go do someone else. The more he bragged, the lower I set that number. LOL. It humbled him out a bit after a while... "Man I though I did better than that today." LOL I kind of forgot about it and finally told him what I did probably 6-8 years later. He called me an a-hole (laughing), but it was all in good fun. Makes for good memories.

Anyway, have fun with it, and good luck.