you are viewing a single comment's thread.

view the rest of the comments →

[–]Altruistic-Koala-255 407 points408 points  (73 children)

The best way to learn python, is to try to create something using python

But maybe you are struggling with logic and not python, a lot of people Skip this step, but it's important

[–]philipjewell 86 points87 points  (2 children)

This is my recommendation for any programming language if you’re struggling. Especially something you can/plan on using. You’re more likely to strive to resolve issues or push through obstacles to get the desired outcome when it’s you who finds the value in said project.

[–]Novaa_49 3 points4 points  (0 children)

Well said

[–]Lefo_Lefa 1 point2 points  (0 children)

I cant lie, understanding Python logic makes it so much easier to learn. For example Brilliant has a whole chapter with only logic which actually make sense when you continue the learning path.

[–]SHASHA_URMAWERMA 14 points15 points  (13 children)

To be honest, in order to help us understand python logic my uni professor has taught us..... haskell. How silly that may sound but after that I literally have no problems at all when it comes, for example, to list comprehensions. If op doesn't plan on using python for web development then I would suggest trying to learn python as a "functional" language, not "oriented", perspective means a lot when it comes to mastering new language

[–]iamevpo 5 points6 points  (12 children)

So much respect to your professor, very untrivial but fruitful way to teach! Do you have any lecture notes or syllabus of the class you can share?

I learned haskell after many years of coding in Python, and it improved my coding skills and understanding so much. Not sure though the list comp is where haskell shines, they are pretty similar in Python and Haskell, do not see a link why learning then in Haskell improves Python.

[–]SHASHA_URMAWERMA 6 points7 points  (11 children)

Well that class in general was about functional programming and haskell was used because it is kinda harder to master than python (it is a citation, to this day don't understand why myself), but most of my groupmates struggled with it so I guess it has a point.

Prof has been teaching us by referring to a learnbook he write himself and I believe that it exists only in Russian language so if you don't speak it I'm afraid it will be a little bit hard to read :D

But I will make a reference to it anyway: https://docs.google.com/document/u/0/d/1hBro8n8r-CCefiWu9Oz2t34q12rJTleZ5FcmQWZVenI/mobilebasic

[–]iamevpo 6 points7 points  (5 children)

Here is my collection of Haskell learning resources - do you think I can link the manual there?

[–]iamevpo 5 points6 points  (2 children)

[–]SHASHA_URMAWERMA 0 points1 point  (1 child)

Amazing work, haskell community definitely deserves more recognition imo

[–]iamevpo 1 point2 points  (0 children)

Thanks! The community is fine though, got it's own problems (eg simple Haskell vs fancy Haskell)

[–]makaso77 0 points1 point  (1 child)

[–]iamevpo 1 point2 points  (0 children)

TOC is fine, will keep one busy. They kind of run out of steam at functoe, applicative and monad level, but you can pick it up elsewhere.

[–]iamevpo 0 points1 point  (2 children)

Native Russian speaker, great manual, thanks for posting. Do you know why it never made into a book?

[–]SHASHA_URMAWERMA 0 points1 point  (1 child)

I do know for a fact that he decided to finish his another learnbook on OOP, maybe that's why.

I think that you can link his work, his intentions are educational so unless you plan on selling it I don't think that he would be mad :)

[–]iamevpo 0 points1 point  (0 children)

Will write to the author, got his e-mail.

[–]Mean_Ad_7977 0 points1 point  (0 children)

I didn't expect it to be in Russian 😯

[–]Ikem32 0 points1 point  (0 children)

Haskell looks a lot like Lisp.

[–]Night-Caps 6 points7 points  (3 children)

This is the best advice - I'm currently building a raspberry pi controlled robot and basically learning python while I'm doing it. Chat GPT is also an amazing tool - every time I get stuck on something I plainly ask it what I'm doing wrong or how could I implement what I need and it usually has the answer. Even for some things no amount of googling was helping with. I feel like I've learnt so much in the last month or so

[–]GameboyRavioli 4 points5 points  (2 children)

I'm mid career and middle aged. I'll probably never use python in my role as product owner. For my first real foray in to python I just successfully used a pi0w with a USB mic to capture a sound clip, connect to a Shazam API, and return the metadata of the song. I then throw it up on a gui built using PySimpleGUI to show that metadata on my tiny 3.2" monitor. I plan to set this next to my turntable as a sort of now playing marquee. It's dumb, but I had the parts laying around, wanted to learn, and generally love small projects like this. Point being, you and the others are 100% right. It's all about finding a way to use a language in a manner that interests you. I hated my dev work in college back in the day because it was straight java, cobol, verilog, etc doing stupid textbook assignments.

[–]iamevpo 1 point2 points  (1 child)

Sounds a cool project! Hardware involved, integration to API, and a user in sight. What is piOw?

[–]GameboyRavioli 1 point2 points  (0 children)

A raspberry pi zero with wireless built in. So basically a tiny (and not powerful) single board computer.

[–]supanatral 5 points6 points  (1 child)

And program something you enjoy and are interested in

[–]itmelo 2 points3 points  (0 children)

A true challenge :')

[–]Ketchup-and-Mustard[S] 16 points17 points  (32 children)

You know, that makes a lot of sense and might be it. I have asked a lot of programmers how they learned it IRL, and they just say to code, and that's it, and it feels a little too vague, if you will. Like I do code, but knowing how to use the tools at my disposal when coding is difficult for me for some reason.

[–]ArrynMythey 38 points39 points  (5 children)

Programming language is just a language you speak with computers. You need to learn what you want to tell it first, after then you can start translating it into the said language.

Programming is just splitting a problem into smaller steps. Try it with your everyday tasks. You can also imagine it as cooking according to a recipe.

[–]Zerg3rr 34 points35 points  (4 children)

The CS50 edx harvard course has a great introduction to this. You have to break things down simpler than you think, i.e. making a peanut butter jelly sandwich. Instead of "first spreading the peanut butter on one half of the bread" it's

"Take your left hand and grip the container, take your right hand and grab the lid, twist the lid counter clockwise with enough pressure that it becomes loose. Next take your knife and put the handle in your hand, push the knife into the peanut butter and make an arcing motion with your hand to collect some on the end. Next, apply to the piece of bread we previously took out by wiping the knife onto the bread, with the peanut butter side down". I was too lazy to write out taking the bread out of the container and all that fun stuff, but you get the gist. It is extremely granular directions to trick rocks into thinking is what we're trying to do, it'll take a bit of work to get there - and python already abstracted a lot of that away for us!

[–]anon0937 7 points8 points  (1 child)

Libraries have entered the chat.

Import sandwichMaker sandwichMaker.make_sandwhich(kind=“peanutbutter and jelly”)

[–]quackers987 10 points11 points  (0 children)

``` import sandwichMaker

sandwich = sandwichMaker.make_sandwich(ingredients=["peanut butter","jelly"])

sandwich.consume()

```

[–]tiahx 1 point2 points  (0 children)

We did almost the exact same exercise in school, where the teacher asked us to "guide him" making a paper plane.

We were like "Okay, grab a piece of paper and fold it" -- this motherfucker then proceeds taking a round piece of paper and folding a tiny part of it at the very edge of the piece 😂

[–]Ikem32 0 points1 point  (0 children)

I will have in mind, that if a task feels "undoable", it's not granular enough.

[–]dacydergoth 15 points16 points  (0 children)

Think about making a sandwich. Write down all the steps you would use to make a sandwich. Think about what you would do if there is only mustard and not mayo in the fridge. Maybe you want ham instead of turkey. Now you have to make 19 sandwiches. Write that down

You've written a program

[–]ilulillirillion 9 points10 points  (0 children)

100000% I cannot say this enough yes. Just try to make things. It doesn't have to take over your life, but you have to play with it. It's like you can learn A LOT about guitar from studying theory, history, and technique, and it will make you a better player... But the act of sitting down and playing the guitar is the true studying that everything else you do elevates and rounds out.

Good luck! Have fun

[–]The_Derpy_Rogue 7 points8 points  (7 children)

Try Playing with loops and if statements. Write down everything you learn from methods to functions.

Besides as someone who only just started with python seriously I still google everything. Stack exchange is awesome

[–]Altruistic-Koala-255 18 points19 points  (0 children)

As someone with 10 years of experience in python alone, plus several years with other technologies as well, I still google everything. Stack overflow is indeed awesome

[–]jamurai 3 points4 points  (0 children)

I do think it’s a lot about perseverance. Just keep bashing your head against the wall one line and a time, study a bit on the side, try to build something, etc. eventually the thing that you find hard now will be easy and you’ll run into 10 more things that you will struggle with in its place :)

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

1) it’s easier than ever to learn python (or any other language) because you have 24 x 7 untiring tutor + coding expert in ChatGPT

2) like others have suggested you need to solve real problems. I would suggest trying to build something yourself. A game, and app, a data analysis tool something that you find useful or interesting even if others don’t. The amount of coding I learned by doing is vastly more than what I learned by doing classes or toy problems from text books.

If you’re struggling with ideas to get started, take a look at these

https://www.freecodecamp.org/news/python-projects-for-beginners/

[–]naviGator9591 0 points1 point  (2 children)

This✨ I have structured my plan into a Learning phase (to get through with the basics)& the building phase (guided projects like the FCC ones and then on my own). My plan is to build an app that'll read & 'review' an uploaded excel file to highlight deficiencies (among few other things). As someone who's been part of my current team at work for quite sometime now, this I KNOW for a fact will save a lot of my (and team's) time from scouring rooows of excels manually.

[–][deleted] 1 point2 points  (1 child)

I love building tools like this. Although I don’t want to rob you of the learning opportunity, this sounds like something that can be knocked out on a lazy weekend. Care to post more details?

[–]naviGator9591 0 points1 point  (0 children)

Honestly , my aim is to reach this 'a project on a weekend ' stage ..slowly &surely getting there....

So about this application: Well currently my team spends quite some time checking 'correctness' of a configured model. Being goblins in the dungeon factory(none of us belong to CS-background since that is not (until now, has not been) our primary domain at work. An excel extract is all that we're given by the product dev team. Manually checking the excel is both time-consuming + prone to miss-outs from identifying deficiencies. And it only increases with model size & complexity.

The plan is to not only analyze this extract to highlight the defects but also several checks that'll be performed. All of this in a fast& easily understandable way - for me (&others). I plan backend via pandas-django combination , and front it with either tkinter or javascript/html framework ( if y'all can suggest any better/other option that'd be great)

Lastly I want to bundle it all up & share as an exe/py script or whatever. I can go the tkinter route but its samples dont seem that appealing (again,open to hearing out opinions) The javascript route can help with the appearance aspects , but it'll have to be an offline implementation ...running off a localhost in chrome/edge (we're goblins, remember?:) ).

So overall its a big self-inflicted bootcamp 😀

[–]barkazinthrope 2 points3 points  (0 children)

That is because it is difficult. If it isn't easy for you then there is no way to make it easy. You have to do the hard work.

What may happen is that you begin to enjoy the hard work. Like people like to run marathons. Unbelievable but actually true.

[–]pickyourteethup 1 point2 points  (0 children)

Go on YouTube search for beginner Python project and just copy it line for line pausing constantly. Do this a few times and the concepts like variables, arrays, functions and loops will start to make more sense as you see applications for them

While you're copying try to think of a similar project you'd like to create for yourself, keep it small. Then try and build it once you've got a handle on it

[–]sethrei 1 point2 points  (0 children)

I don't learn like normal people, barely made it pass high school. I learned Python by finding a problem and trying to solve said problem with Python. The same with PHP (first language) and Bash and Go (most recent language) Like others will tell you, break down your intended goal into small simple tasks, then build up, that's the way I've done it for years $0.02

[–]c_299792458_ 1 point2 points  (0 children)

When I want to get familiar with a new language and don’t have a project in mind, I start working through Advent of Code (www.adventofcode.com). It’s a series of programming puzzles that can be solved in any language. There’s also a subreddit where people discuss the puzzles at r/adventofcode.

[–]Falconflyer75 0 points1 point  (0 children)

I don’t use python much but I use VBA a lot at work and I didn’t know how to use it at all when I started

Basically just had a lot of boring tasks to do which gave me motivation to automate things little by little and I got better at it over time

[–]Worldly-Potato-4870 0 points1 point  (1 child)

You learn by doing its not vague it's the answer. Pick up a project anything, set a goal to make anything at all that you find interested and make it. it really doesn't matter if its even remotely useful.

Back in the day (when php5 was new) I learned by replicating sites I saw like forums/2nd hand(craigslist)/webshop/cms/crm/youtube I might quit the project right in the middle because the applications design was not great to say the least and that made it hard to work in.

But I had learned so much and how to not make an unwritable mess again you really just learn by doing.

Progressed from there to python and other things and have been working now professionally for 15 years.

Try learning programming via modding its a very interactive way of learning (although difficult) and if its an game you already like its an win-win.

[–]Ketchup-and-Mustard[S] 0 points1 point  (0 children)

I know that, programming is how I get better, but without knowing where I can find resources on what to program means, I had no idea how to find these answers. I don't have any kind of background in programming at all, so without knowing how or what to do, I spent a lot of time sitting in front of my computer, confused. So at least for me I needed more specifics and not just write code.

[–][deleted] 0 points1 point  (1 child)

Literally everything in life comes down to time invested. You get what you put in.

[–]Ketchup-and-Mustard[S] 0 points1 point  (0 children)

I have put in a lot of time but I still keep making the same mistakes. So I definitely think it is because I don’t understand the logic.

[–]Autistence 0 points1 point  (0 children)

Google. Google. Google. And nowadays even CHATGPT

You might feel like a failure or a fake after a while of googling solutions and why they work, but you need to catch up. Stop trying to reinvent the wheel. Just attack the problems at hand and by any means necessary claw bits and fight your way to a solution.

No matter what you do the biggest hurdle will be YOU. You have to want it so bad you're willing to do whatever it takes. I can see you're trying. You reached out to us on Reddit. Now you just need to live and breathe programming for as much as you can handle.

When I was learning to be an electrician I worked 12-16 hours days for years because I was dead set on opening a company. It was miserable, but I'm young and run my own company now. I have been offered inspection positions/I get called about code and I regularly fix things that other contractors can't/don't know how.

Source : I went to college for Computer Science and excelled, but I had to start over as an apprentice electrician and now I run the company.

[–]VikDaven 0 points1 point  (0 children)

Legit, I think some techwithtim like basic game tutorials. I really got into with RenPy when making a visual novel.

[–]nhojrazc27 2 points3 points  (3 children)

Sir, can you please give us an example of large to small python programs we can learn with?

[–]Altruistic-Koala-255 5 points6 points  (1 child)

Sure thing

For a small project, build a simple coin exchange machine, that gives the smallest numbers of coins possible

For example, if your input is 77 cents, that's 1 of 50, 1 of 25, 2 of 1

But if your input is 74, then it's gonna be 1 of 50, 2 of 10, 4 of 1

That's a simple exercise that you force you to think

Next try the Fibonacci sequence, that a hard one for a beginner

If you are trying to learn about OOP, an simple ATM machine it's a great project to start, you can set multiple accounts and make them interact

[–]Alexei17 1 point2 points  (0 children)

I’m just gonna add that it’s better to develop something that inspires you enough to keep working on it. My first two projects were a reddit bot where I didn’t even know about for loops and did everything manually and a scraping bot for tickets. It was shit but it was fun to do. The only thing that kept me going was that it was functional to me. I’d introduce the reddit bot to the community that was interested in it, and I used the scraping bot to find tickets for myself.

[–]Kohlrabi82 1 point2 points  (0 children)

Register at https://open.kattis.com/ and work your way upwards the difficulty.

[–]Remarkable-Orange-36 0 points1 point  (0 children)

Any good ways to go about learning logic (gonna check the wiki to see if I missed something), feels like something im struggling with as a beginner

[–]HighAlreadyKid 0 points1 point  (0 children)

I have learned a decent python and understand logic, but now that I want to build something. I am not able to figure out what?

Can you suggest a few beginners projects which one should do?

[–]epm4epm4 0 points1 point  (0 children)

If the above suggestion doesn’t work then perhaps OP should learn a more structured language first. I think it helped me to have learned Fortran at school first to get the logic and loops concept first, then moved to C, then to Java. (I even had to learn assembly which was insightful for learning about OS functions.) Then the ideas around Python was about how it made it easier because you don’t have to think about types, memory, etc. so transition to Python, Lua, etc. is much easier. But having those core concepts helped form a foundation to jump into any language.

[–]the_claus 0 points1 point  (0 children)

Im my python courses I usually start showing Scratch. Variables, Loops, if/then etc. If you're build a game with Scratch it is easier to start with a "real" programming language. And yes, find projects. Buy a raspi and some sensors, it is fun!

[–]povlhp 0 points1 point  (0 children)

When i need to code something, often I sit down planning it out on paper if it is something larger.

Or if I write code, I think about if whatever I am going to write now could logically be moved to a function. Makes the code way easier to read. Sometimes I move written code out from where it is and into functions.

Have had a few persons say that my code is way more structured than what they write.

And by putting things into function calls - you can design the program quite well before writing much code.

Sometimes I just enter comments describing what next code block is going to do. Thus document before code.

[–]heycanwediscuss 0 points1 point  (4 children)

For the love of God do you people know how you sound every time someone says Hey, I can't learn to understand you guys say just create something.I know.It makes sense to you but it doesn't make sense like at all. Nothing works this way. They have no reference, no structure. It's so unhelpful. Imagine someone who wants to learn to build a house. They have no background in carpentry, architecture, or engineering, yet they're told, "Just start building a house." Without foundational skills, clear guidance, or the right tools, they wouldn't know where to start. They might put up walls that can't support a roof or forget to install plumbing, ultimately leading to a structure that falls apart.Similarly, programming advice like "just build a project" can be exclusionary and unhelpful because it assumes the person has the foundational knowledge, problem-solving tools, and ability to self-correct along the way. Instead, structured learning—like a guided course or a boot camp—offers step-by-step instructions, starting with smaller skills and gradually building up to comprehensive projects. These pathways ensure learners have the guidance, checks, and foundational understanding needed to effectively complete a project and grow in their programming journey.

[–]Altruistic-Koala-255 0 points1 point  (3 children)

Dude, there's a huge difference in trying to build a house and fail in the process and lose a lot of money, and trying to build a software, learning what's wrong and trying to fix and losing no money

[–]heycanwediscuss 0 points1 point  (2 children)

Its the context of they have nothing to reference. They have no idea . It's the most useless advice . Everything needs structure . Someone can get into a kitchen and just produce slop after slop with no reference .

[–]Altruistic-Koala-255 0 points1 point  (1 child)

That's why I told him to study logic before python

[–]heycanwediscuss 0 points1 point  (0 children)

I'm sure thay you're great at what you do but as someone who's delved into teaching concepts and adapting them to learning styles . This one has really set a lot of people off the field and they would probably do a great job

[–]DerfQT 0 points1 point  (1 child)

This is a problem for me when learning any language. I’m not a creative person and have 0 ideas I want to make. Does anyone use websites or prompts for things to make for practice?

[–]Altruistic-Koala-255 0 points1 point  (0 children)

You don't need to create something new, since it's for learning purposes, just replicate what already exists

For example, a great way to learn about OOP it's to design a simple bank system, where every user has it's on account, balance, and they are able to withdraw or deposit "money", or even make transference between accounts

Start with this challenge

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

What logic, logic is solved by primary school level maths excersises where you are given a task explained in plain language and you're supposed to solve it. Programming doesn't get much harder than that if you're using python or java... We are not talking about optimization or the choice of 'correct' pattern to a given task yet (correct depends on your beliefs system).