r/learnpython • • Dec 20 '24

Hey how did you learn?

I found a 100 days course udemy , that’s seems to be doing good so far, I’m wondering how I should learn python?

0 Upvotes

31 comments sorted by

16

u/dowcet Dec 20 '24

Build stuff. Focus on what you want to build and let that guide your learning.

4

u/astddf Dec 20 '24

How do you bridge the gap between building things and knowing what’s even possible to build

3

u/ninhaomah Dec 20 '24

Name one project thats impossible to build with Python.

Maybe not the best tool but we are talking if it is "possible" with Python. Or .NET or Java or C or C++ or C#.

4

u/astddf Dec 20 '24

I’m saying more from a complete beginner’s perspective rather than someone who knows another language. I just genuinely don’t know enough to know what it’s capable of. I can come up with some dumb thing like can it log into my instagram at 5pm and see what pending messages I have and send me a text with a report of it? Bad example but I’m just saying the line of limitation is hard to draw in my mind

3

u/Narrow_Ad_8997 Dec 21 '24

To @ninhaomah 's point... Yes, you can make it do that 'dumb thing' and you will inherently learn a ton about all of the inner workings of said project just by taking it on, step by step.

1

u/astddf Dec 21 '24

I didn’t know there was an instagram api haha but I get your point.

5

u/escapemyfate416 Dec 20 '24

I started with the 100 days, then about 2 weeks in I did the CS50 and then CS50P courses instead. Then just found stuff to build - notification script using APIs for my raspberry pi, stock market pattern scanner, currently working on a game, and then just a lot of little things. Takes a while to get going but after a while things just start to click. Also be sure to learn from any errors that get triggered rather than just fix it. Courses are great to learn basics and syntax but really you learn more by doing

3

u/HolidayEmphasis4345 Dec 20 '24 edited Dec 24 '24

I learned python after learning C many years ago (>20!). I have found in the last couple of years that LLMs are really good at improving code at the function level. If you have a function or method that ‘works’ ask an LLM to improve it. I have learned so much about python this way. I can see that my knowledge was pretty good but in many instances I was doing things in two steps when there are ways to do it in one step. It is important to start with code that YOU WROTE and understand and hopefully have tests for. It will maybe switch a datatype to sets to and use set operations to minimize code, or have a clean way to use divmod instead of a bunch of math and if statements. It will also remove easy loops and make them comprehensions. You do need to be careful because it can go full code golf which sucks. I have this as my default prompt text in ChatGPT. These prompts make consistent code for me.

python is default language

always add type hints to python code

add google docstrings <= 90 characters wide for all functions and methods

always add docstrings to functions, classes and modules

code should be <= 90 characters wide

use pytest for all python testing

logging messages in python should not use f strings

you should use pathlib instead of os for python code

when using date time use “import datetime as dt”

when using pandas use “import pandas as pd”

my home operating system is windows

docstrings should not have text like “this function does...”

please reason step by step

when making for loops I like the form for item in items: where there is a singular and a plural

I prefer f-strings over .format

4

u/ohnoplshelpme Dec 21 '24

Yeah right buddy, I don’t think you learnt C 2.4x1018 years ago. Pffft

1

u/HolidayEmphasis4345 Dec 27 '24

My bad, nanoseconds not years.

2

u/[deleted] Dec 20 '24

I learned by doing it for my job doing automated tests. Nothing like on the job training.

4

u/pomegranatebeachfox Dec 20 '24

Same here. I started playing around with it for fun and then realized it was the solution for multiple problems at work. Suddenly I was spending hours a day on the clock figuring out code and now we have a functional system.

It isn't pretty. But it's functional 😅

1

u/[deleted] Dec 21 '24

That’s how exactly I feel

2

u/[deleted] Dec 21 '24

This is a great course. Just keep doing it every day.

1

u/Adrewmc Dec 20 '24 edited Dec 20 '24

I bought a program/bot…and thought I could do better than what the guy did.

I was right.

He wrote that in Python…so I’m here. (Going on like 3-4 languages I can read now lol, but I’m most proficient in Python)

But I’d probably have given myself the same thing as he did for the price he did. If I was him now. e.g. I don’t feel he ripped me off, I didn’t spend much I didn’t get much lol. there were parts that confused me for some time.

Frankly having that program changed my life anyway, I would buy it again. I had gone through some tutorials like long ago…but having a completed thing, (and not like an example thing) that did what I wanted, in front of me opened my eyes to how it was done…and the rest is logged. I basically figured out how it worked and along the way I happened to learn the basics of Python.

2

u/[deleted] Dec 21 '24

Genuinely, I have learned so much by dissecting other people's code. I have a manufacturing background and can't even begin to count how many times I've changed code in machines specifically because something was annoying the hell out of me and I knew I could improve it.

It's easier to ask forgiveness than permission, and the higher ups don't care that you stole an optical sensor from the stock room if you used it to stop a robot from smashing up a few hundred $$$ of product an hour. Seriously who the hell runs a conveyor system using a timer and a pneumatic knife? Just begging for problems.

1

u/ninhaomah Dec 20 '24

You should be asking why did you learn ?

1

u/rainyengineer Dec 21 '24

I tried a few commonly recommended ones (mooc, cs50, automate the boring stuff) but none of them really suited me. Then I tried the book Python Crash Course and loved it. The author explains everything in a really beginner friendly way and has tons of code exercises right in the book.

I had the pdf/e-book up on one monitor and my IDE of choice (vs code) on the other so I could code along. I did about an hour a day 4-5 days per week for around 3 months.

My biggest pieces of advice are to:

  • Find what works for you and don’t be afraid to hop around if the author/instructor isn’t working out for you.

  • Review previous material you’ve learned for 15-20 minutes each day before starting new lessons. This helps a lot with retention.

1

u/[deleted] Dec 21 '24

Initially, school, then work(out of necessity). Getting into actual projects is where the real learning(and fun) happens though.

I just finished a course on data structures for the semester and after programming a game of hexapawn with basic machine learning I'm diving right into that branch of programming because it's cool as hell.

Downside? I'm weak in higher mathematics so some of the material I'm reading is requiring further reading just to know what I'm looking at. I do thankfully have a strong background in finance and a basic background in stats though so the focus of my current self directed studies being financial machine learning is progressing.

1

u/[deleted] Dec 21 '24

Python was something I dabbled with when I was like 13. Software programs have always interested me, I wanted to know how they worked. I graduated high school and got into the big 3. Money was alright but I was bored. Decided to start dabbling again, found Freecodecamp.org and never looked back.

I'm building AI models now.

1

u/queerkidxx Dec 21 '24

I learned by starting with code academy, building a few projects, learning a few big libraries via tutorials and then from there building and readings docs for libraries

1

u/Worth_Specific3764 Dec 21 '24

Realized i wanted to do something and be extremely lazy about it. Never programmed before, not really. Maybe a year later I’m “this close “ to being able to do the thing and I had to work through a lot of projects to get me there. So I’d pick a small project and go from there, always adding to your skillset.

1

u/dragonsbecrazy Dec 21 '24

I’m still learning… 🤗 but as a complete beginner and coming from a non-technical background, I found the Python Done Right course from Nodeledge.ai a great intro to learning Python. Good luck!

1

u/rebcabin-r Dec 21 '24

on the job. i needed a simulator for a custom ASIC chip. I was going to write it in Clojure but then realized no one else would use it. i wrote it in Python but it ended up in c++ because that's what people wanted.

1

u/stockdam-MDD Dec 21 '24

Start by solving a problem that you have. It can be small and simple. When you have it working then be critical and improve it. For example add pop up windows asking the user to select a file rather than hard coding it in; add error checking. Try to make it better and faster. Keep going until it gets to the stage where you would “pay money for it” as it looks and feels professional.

By solving some of your own problems or frustrations, you have something real to solve, a critical customer and a direction. I find I learn much better when I focus on solving a problem rather than following generic training.

Ok so that approach won’t teach you everything but it’s a good way to start. I’d then look for “challenges” on the internet and try to solve them. 

1

u/1zain1 Dec 22 '24

university

1

u/Technical-Ad-565 Dec 22 '24

Code and test. Repeat 1000 times. (Have been coding/programming since 1979.)

Any documentation/manuals does help.

1

u/TheRNGuy Dec 25 '24

Python from docs mostly, and then trying to do things for SideFx Houdini. I learned Python specifically for it.

I never watched any youtube tutorials.

I did read some blogs, or googling.

Never used AI (I didn't know it's a thing, but when it became a thing, I still don't use, because it's not really needed for simple things, and it can't write complex good code, or maybe it's easier just write myself than re-writing queries for many times)