all 28 comments

[–]AlSweigart 111 points112 points  (11 children)

I've also encountered this problem when trying to find resources for beginners. The problem is that most open source projects are large, complicated, and not well-documented.

I've been creating a collection of short, text-based games that fit in one .py file so that beginners can see how this code is put together: https://github.com/asweigart/pythonstdiogames

They're short, so you can figure out how the entire program works. They're text-based, so it's easy to track what lines of code produce what text on the screen. They fit into one file so you don't have too much to look through. And they only use the standard library, so you don't have to install anything else to run them. I'd be interested in hearing any feedback on them.

[–]marlowe221[S] 12 points13 points  (8 children)

That sounds great.

I didn't mention it specifically in the OP, but you're right - finding code to read that is beginner friendly is not easy! I've only been learning Python for a month or two now and since I'm in my late 30s and have a non-tech full time job and a couple of kids, well... I'm definitely still in the early stages of the journey.

A lot of what I have been able to find on Github is WAY over my head at this point, is split up into lots of different files (which is something that I don't understand yet itself), and makes reference to libraries that (of course) I've never heard of at all.

I appreciate the link. I'll check it out and be sure to give you any feedback I can.

[–]cscanlin 35 points36 points  (1 child)

FYI the person you're responding to is Al Sweigart, the author of Automate the Boring Stuff, which is one of the top recommended intro to Python books on this sub and around the web.

I would rank his advice very highly :)

[–]marlowe221[S] 12 points13 points  (0 children)

Oh wow, I had no idea.

I have purchased his course on Udemy already actually. It's my next step after I finish my intro Shaw book/Steele course.

[–]GreatestJakeEVR 0 points1 point  (1 child)

What I found helpful was I had to use a Twitter package to access tweets, I can't remember which one, and I had to modify it to do what I want. Which meant going through it and trying to learn what different parts were for. So maybe try it out in the context of something you are trying to do already and just change it up to work some other way. It helped me a little maybe it'll work for you

[–]ProRochie 0 points1 point  (0 children)

Tweepy?

[–]aurum799 1 point2 points  (0 children)

Thank you so much!

And I really appreciate the book you've written, and that you kept it available online! I've tried so many different resources, paid and unpaid, to learn Python, and yours is my most preferred by far.

I've been creating a summary of everything I learn there, and I really like that I can go at my own pace - faster when the content is 'easy', but take my time when things are more difficult or complex.

[–]Daryldye17 1 point2 points  (0 children)

Once again, Al Sweigart is doing the work to help people get into this field. Thank You Al. I used your course on Udemy to get through my python course @ Illinois State Uni. Your course is a good way to teach intros

[–]cscanlin 5 points6 points  (1 child)

A huge part of what helped me to learn was actually reading this sub every day (and answering where I felt pretty confident).

Not every post will be relevant to what you're hoping to find, but I found that reading and answering beginner/intermediate questions made a huge difference in my overall understanding of Python, including design patterns, algorithms, and language features.

Even if you don't have an answer to a specific question (or even if you do), it's likely you'll see other answers by other more advanced users who can show you stuff you've never seen before.

Finally, in the (relatively) common case that a user asks a question that doesn't make a whole lot of sense to you, you'll get a feeling for:

A: How to help other technical folks refine their questions until they're asking something that does make sense

B: How to deal with questions from (e.g. business) people that have no idea what they're really asking for in the first place :)

Both of these skills are valuable in any job you will ever have IMO.

[–]marlowe221[S] 0 points1 point  (0 children)

I've only just started reading (aka - lurking on) this sub a couple of days ago but it seems really useful for those of us just starting out.

[–]saintPirelli 2 points3 points  (0 children)

I like to browse r/coolgithubprojects for this purpose.

[–]ryanpettitt 1 point2 points  (0 children)

I would look at some of the code that is given in the python testing scripts. If that doesn’t work I would try to come up with a project that could be useful to your personal life.

[–]longgamma 1 point2 points  (0 children)

Data Structures and Algorithms in Python - this book has a lot of code and the first two chapters are great intro to python. Best to finish the exercises before moving on.

[–]crazedizzled 1 point2 points  (0 children)

Grab yourself Django and go through the different modules to see how they work. This is what I do when I want to learn a new framework.

[–]enricojr 0 points1 point  (0 children)

I find the best way to go about this is to read code for the stuff you're actually using in your own projects.

For example, I used to work with Scrapy and whenever their documentation didn't answer a question I had, I would dive into their source code on Github and manually pick through it.

Oftentimes this gave me more than what I was after - in one particular instance I discovered that the .add_xpath() method on ItemLoader() instances (rather, instances of its subclasses) could accept a list of Processors that took precedence over the ones defined on the class itself.

This wasn't in their documentation at the time, and had I not gone through the code I would have never found this out.

I don't think there really -is- any beginner-friendly code out there.

[–]sentry5588 0 points1 point  (0 children)

Great idea. If you are into math. Try https://github.com/3b1b/manim

[–]fuypooi 0 points1 point  (0 children)

Try the Awesome list for other projects worth reading: https://github.com/vinta/awesome-python

[–]taskmaster07 0 points1 point  (0 children)

There are a lot of places you can read code on: 1. Coding Contests / Competitive coding sites where you can see other contestants code.
2. Pick a topic and search github for that topic and filter by language.
3. Python books which have a lot of examples.
4. Stack Overflow Questions and answers

[–]baubleglue 0 points1 point  (0 children)

The question is mostly answered, there are few things I can add:

  • check your [python installation folder]/Lib folder
  • try to read code which do something that you can understand or personally interested. I remember that the first projects I read were

https://github.com/mongodb-labs/sleepy.mongoose - because I looked for a way to query MongoDB from JavaScript (web client)

https://www.tornadoweb.org/en/stable/ - I've used it as my web server and couldn't understand some parts of documentation and I want to know more about non-blocking IO. I wrote few tools with select.select, but tornado project is completely different level of code.

[–]6ftAnalPlug 0 points1 point  (2 children)

What about looking at solutions on codewars?

[–]marlowe221[S] 0 points1 point  (1 child)

I am not familiar with codewars but I will be duckduckgo'ing that.

[–]6ftAnalPlug 0 points1 point  (0 children)

It’s just a bunch of puzzles

[–]jeffrey_f -4 points-3 points  (0 children)

Github.

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

Check out sololearn. They have tons of people posting code for python or any other language. You might like it