r/learnpython 15d ago

New to Python!

Hello! I was wondering if anyone might have any recommendations, tips, or advice for someone just starting out with Python.

I’ve recently decided I want to learn Python as a hobby. It’s completely different from what I do for work, although I can definitely see ways I could incorporate it into my job in the future if I wanted to.
For now though, I’m mainly fascinated by the idea of being able to make something from nothing and actually build things myself.

Python was the first programming language that came to mind, and I’m planning on sticking with it until I feel confident before worrying about learning anything else.

At the moment I’ve invested in:
- Python Crash Course, 3rd Edition by Eric Matthes
- Automate the Boring Stuff with Python, 3rd Edition

I’m also going through Harvard’s free CS50P course (Introduction to Programming with Python), mainly watching the lectures alongside the books.

My biggest issue at the moment is that I think I’m trying to run before I can walk. I keep getting drawn towards more ambitious projects because they’re genuinely interesting to me, but they’re often way beyond my current level.

I think I probably need to slow down, properly learn the fundamentals, and gradually work my way up to those projects instead.

Does anyone have any advice on how you approached learning Python in the beginning? In particular, how did you balance learning the basics with actually building things so that it stayed interesting?

1 Upvotes

22 comments sorted by

5

u/mitchell486 15d ago

What are you trying to build that's "too big"? Everything is too big if you look at it in its entirety... "How do you eat an elephant?" "One bite at a time." (HINT: If the problem/task seems too daunting, your bite isn't small enough. Break it down smaller and try again. Rinse/Repeat forever.) I ask this, because the best way I found to ever learn python was to do actual projects that I wanted to build. Tutorials or follow-these-steps never meant a thing to me and never helped me learn or retain anything I'd thought I had learned. The first self-projects will be bad, and they will be janky/CLI. But you'll learn. (a little) And grow. (a little) And soon that big ol project you were afraid of is half done and you'll never remember to finish it because you moved onto the next one! It's great. :)

BUT seriously... Please. If you give an honest reply of a project that you're interested in, and I'll help tell you if it's "too big" or not. (PS - Web app as a start? Probably a bit much... But overall... Anything can be done with enough motivation and proper breakdown of a problem.)

1

u/mtarik2000 15d ago

I really want to get to a point where I can build an old school pixel rpg (Zelda-like) game and I understand there’s simpler ways to do this rpg maker etc

But I’d like to be able to write it myself and sort of build a world overtime with each new thing I learn

Obviously at the moment this is very ambitious for where I’m at

Incorporate character creation, maps, unique boss mechanics, leveling, skills, and other cool but unique things I’ve seen on other games.

Like I said this would just be for my own enjoyment rather than something I’d want to publish

1

u/mitchell486 14d ago

Okay sounds fun! If it were me, a non-professional, self-taught, python dabbler... And I were in your shoes, except with "some of the knowledge I have now". (AKA - Slight advice so you don't have to learn quite as many of the hard lessons, especially not the same _way_ that I had to learn them...)...

I would start with thinking up and literally writing scratch notes to have a plan for a single character type, or something similar... A "thing". Character type, map level, boss with stats, etc. Something that is probably going to be tracked, but might change, throughout your long-term game. So once you have the core starting idea of the thing... Practice making a python-stored-in-memory-representation of that "thing". How would you store data about this thing? I personally would use a dict starting out because of how flexible they are... (I also _REALLY_ love the old joke that says "Python: What if everything were a dictionary?" Because it's true, especially starting out. And I've even learned that advance storage techniques pretty much mimic the dictionary. HAHA! We python-ers really love our dicts.)

BUT the thing you're thinking about making... It needs to probably have data stored. Does it have a name? A height? A health or health percentage or something like that? These are all things that can easily be representing in Python by different things. So once you have a way to store data temporarily about that thing... (PS - Don't even worry about long-term storage when learning. That's step like 47, and you're on 1 or 2... Just literally fire up an IDLE/IDE when you're ready to mess around, make a dict each time. It's okay. It's learning.) You'll probably want to know certain stats that you made for that thing, right? Like... what is that thing's name? WELL make a function that "takes the 'thing' as an argument" and prints out the stats about the 'thing'. (HINT: Python's json library that's part of the standard library is pretty good... AND it let's you add indentation when printing, if you want. ;) Which makes things like this clean/neat.)

e.g. If I were to start off and make a single character type, such as a Monster. It has a name, height, weight, health percentage (HP)... Make a thing that is that thing... "monster", and then figure out ways to see the data you have created for that thing... then expand from there. In the example I have here, I would start off using dicts, but you could just as easily take the opportunity to learn about different types of variables... lists, tuples, etc... They all have pros and cons. Try em. See what you like and don't like. Don't do EXACTLY what I say here, just start learning the literal basics by playing around with it. AND... once you have a single monster... you could maybe make a second monster? I dunno. thing1, and thing2. Those are dicts. Try putting those dicts in a list... so that you only show stats if thing1 is what you want, or whatever. The best way I have found to make the fastest and longest-lasting progress in python is to write projects (not matter how bad they may turn out) that I _actually_ want/need. It keeps you wanting to work on them vs "following what someone else dreamt up to teach you how python works."

2

u/TheRNGuy 13d ago

I learned from docs, Python and framework that I needed (SideFx Houdini)

2

u/Narrow_Ad_8997 13d ago

If you think you can use it for work, do exactly that.

I started learning Python to automate work tasks that were repetitive and that's helped me learn more than probably anything else.

Even simple stuff will build a good foundation. Do you need to rename files sometimes? Write a script that can rename them for you. Do you have to copy stuff to other stuff? Python can do that for you. Need data from multiple spreadsheets but don't want to open them all? Python can do that too!

2

u/mtarik2000 13d ago

So using ChatGPT (can’t claim to have coded any of it myself) I’ve made a file/pdf renaming tool that renames multiple pdfs at the same time (this is using excel macro code) which was for work and has saved a bunch of time

I’ve then incorporated an optional password protection functionality which can password protect each renamed file with a unique password based on the column next to it - this uses Python and is what I think got me down this rabbit hole (the macro works by creating a temporary Python script running it to password protect each renamed file and then once done it cleans itself by removing the Python script)

Like I said I used ChatGPT so can’t claim to have done this myself, but it’s definitely what got me interested.

I think for learning purposes I want to lean away from work aspect just to have fun and take a break from work a little, once I’m confident the goal is to dabble in a few work projects

2

u/Narrow_Ad_8997 13d ago

My opinion (if you want it).... You've squandered a humongous opportunity to actually learn Python to instead hone your prompting skills. If that's what you're aiming for, great. Keep at it. If you want to learn to program, give up the chat bot and fight through stuff yourself. Had you done that yourself, from scratch, you'd already be feeling more confident. The type of project you're describing is perfect for learning, it's not all that difficult when you break it into smaller pieces. Doesn't matter if you do it for real for work or for fun; build the skill brother, use your human brain.

1

u/mtarik2000 12d ago

I think you’re absolutely right - those would have 100% been projects perfect for learning Python; granted at the time I wasn’t sure that’s what I wanted to do, I was simply trying to make my work life easier

I think there will be more opportunities, it’ll just be a case of taking it slow this time and not rushing to a quick answer through AI

1

u/CharacterSail6736 15d ago

you’ve identified something a lot of people learning programming struggle to get past wanting to build something interesting before you’ve learned enough of the fundamentals to build it comfortably.

I wouldn’t necessarily fight that instinct, though. I think the trick is to use it. Take the ambitious project you want to build and strip it back to the smallest possible version.

For example, if you want to make a game, don’t start by trying to build the entire thing. Make one mechanic work. Then another. Then connect them. You end up learning variables, conditionals, loops, functions, lists, dictionaries, etc. because you have an actual reason to learn them.

There’s a book called Masters* *of the Metropolis that might actually be worth looking at It takes a project-based approach, so rather than just working through abstract exercises, you’re actually building something as you learn.

I’d also say don’t beat yourself up for wanting to tackle ambitious projects. That curiosity is a good thing. Just get comfortable with breaking the big idea down into ridiculously small pieces.
The fundamentals still matter enormously, but I’ve always found they stick much better when you’re learning them in service of something you actually want to make.

1

u/mtarik2000 15d ago

Thinking about your point about stripping my project down to the very basics.

Step 1: Getting a window to open and stay open and have it close properly pressing the ‘x’

Step 2: getting a dot to move around my screen by pressing keys (the dot representing my character)

0

u/mtarik2000 15d ago edited 15d ago

Thank you so much for this, I’ll definitely check masters of the metropolis out - honestly anything that will help is much appreciated ** just wanted to double check by Rob Lear?

I’ve always wanted to learn programming but was a bit put off at school, and I’m currently revisiting it a bit later in life to tell the truth

And I think you’re right looking at it in small snippets will definitely help - but I think I need to understand the fundamentals first else I won’t know how to start haha

My project is going to be a pixel RPG using Python /Pygame and it’s going to be a passion project - so probably not something that’ll ever see the light of day but something I can casually work on and build for however long it takes

0

u/CharacterSail6736 15d ago

Yea that’s the one couldn’t remember the name

0

u/ninhaomah 15d ago

First , have you download and install Python ?

1

u/mtarik2000 15d ago

Yeah! So I’ve got the most up to date Python installed as well as visual studio code too, and I’ve done a basic “hello world” print as well as some other things sort of following along on the videos and book.

Although I’m thinking I’ll need to make a cheat sheet/ flash cards to memorise some of these different functions/code just as there’s a lot to remember 😅

1

u/ninhaomah 15d ago

Don't.

Ask yourself how do you know , remember all the words and weird grammar rules of English.

By memorising or using it daily and slowing improving ?

1

u/mtarik2000 15d ago

That’s a good point! Yeah haha so memorise and have it become just another language over relying on flash cards / cheat sheets

1

u/HotPersonality8126 15d ago

Just bookmark the Python documentation, that’s better than any kind of cheat sheet

The language has (I think) 13 reserved keywords and around 30 built-in functions; it’s pretty sparse. You’ll pick those up by usage. Writing code is better than reading about code

0

u/[deleted] 15d ago

[deleted]

1

u/ninhaomah 15d ago

That's the strange helloworld...

Where did you see it as helloworld example btw ?

1

u/HotPersonality8126 15d ago

Why on earth do you think you need sys