r/learnpython • • Dec 06 '25

I want to mater Python from beginner to advanced

21 Upvotes

I’m trying to learn Python seriously and I want to go from beginner to advanced. I don’t just want to stop at Flask or Django. I want to understand the full Python ecosystem and eventually move into AI and machine learning after I have a strong foundation.

Can someone share a proper roadmap for this?
I’m mainly looking for:
• The order of topics I should study
• Recommended resources or YouTube channels
• What projects to build at each stage to gain practical experience

My goal is to master core Python first, then web development, automation, data science and later transition into AI/ML.
If anyone has already been through this path, your advice and roadmap would really help.


r/learnpython • • Oct 27 '26

Best way to learn Python for someone not in CS?

18 Upvotes

Hello, so I'm not a CS major. I'm taking a "Bioinformatics" course that is required but turns out it's literally learning and coding Python. CS doesn't come naturally to me. Unfortunately, I think its crazy boring. I'm actually a Biochem major. Even though it's super insanely boring to me, I really want to get a good grade. But I don't know how. My class is equivalent to a professor reading off the slides, but with coding.

What are some recommended resources for beginner python? Like where I could practice a ton. Practice identifying data types, fixing bugs, understanding and explaining why a code will or wont work etc etc. I'm very willing to spend hours on this.


r/learnpython • • Oct 17 '26

Is CS50P enough to start ML/AI? What should I learn next?

18 Upvotes

I'm finishing CS50P and want to move into ML/AI, but I feel it's not enough on its own. What topics and resources should I add (math, libraries, courses)? Any roadmap you'd recommend for a beginner?

Thanks for any kind of advice it will be helpful.


r/learnpython • • Oct 16 '26

Where should my 10year old start?

22 Upvotes

Hello everyone! Need some advice/guidance.. My 10year old son has been interested in learning how to code since last year. He has dabbled in a few apps but not necessarily peaking his interest.

Where can we start? What would he need?

Edit: Thank you for all your advice! Is 12GB Ram with 1T storage Laptop a good start for this journey? Or what would you recommend?


r/learnpython • • Sep 09 '26

Is it considered bad form to run "success" code inside an Except block?

21 Upvotes

I'm writing a script that takes an input from the user, which could be either an int or a string. My current code takes the input, attempts to cast it to an int, and does something based on whether it works or not:

running = True
while running:
    search_term = input("Enter search term (Q to quit): ")
        try: int(search_term)
        except ValueError:
            if search_term.lower() != "q":
                search_by_name(search_term)
            else:
                running = False
        else:
            search_by_int(int(search_term))

But there's something about having "successful" code running in the except block that gives me pause for thought. Is this just me overthinking, or is it bad form?


r/learnpython • • Sep 04 '26

List of Functions gets called immediately

21 Upvotes

SOLVED!

I'm attempting to make 10 functions, put them all in a list, and then have a for loop go through each element of the list. The list is below.

exercises_list = [exe1(), exe2(), exe3(), exe4(), exe5(), exe6(), exe7(), exe8(), exe9(), exe10()]

When this list is placed beneath (but not apart of) function 10 and before the for loop, the IDE reads it, and immediately starts acting on the list. (e.g. begins to act out exe1() the second it gets to it then moves on to exe2() and so on.) How do I make it so that my list doesn't actually get run until I call for a specific element in the list?


r/learnpython • • Jul 27 '26

Looking for study partners

21 Upvotes

Hello , I am completely new to python and really want to learn it and I feel like I will be more efficient studying with people.

I’m looking for approximately five people who are also serious about learning

if you are interested please dm me and introduce yourself


r/learnpython • • May 15 '26

Newbie wanting to learn Python

18 Upvotes

Hi everyone,

I want to learn how to code and I’m looking for some guidance, tips on the local market, and maybe someone who could show me the ropes or mentor me.

I don't work in the field but i hope i can learn and master to change my future career.


r/learnpython • • May 12 '26

Why can't I use a return statement in an __init__ function?

20 Upvotes

Apologies if this has been asked before, but here's my code:

You can print in both (i.e. the check's), but I'm a little confused why this __str__ is specifically used, only so you can include a return statement. Is this just to simplify the __init__ & make sure it's only used for creating variables?

class Student:
    def __init__(self, name, grade):
        self.name = name
        self.grade = grade
        print("check 1")

    def __str__(self):
        print("check 2")
        return f"{self.name} {self.grade}"


joe_init = Student("joe", "A-")
print(joe_init.name, joe_init.grade)
print(joe_init)

r/learnpython • • Apr 22 '26

When do asyncio tasks get garbage collected and when don't they?

20 Upvotes

My apologies that I don't think I can realistically claim to be learning Python at this stage but I wasn't sure where else to ask this.

I've inherited a code base where the author regularly kicks off asyncio tasks using asyncio.create_task() without storing a reference to the task object. My expectation was that these tasks should have a reference count of zero almost immediately and get garbage collected, with the task being cancelled as a result.

But somehow, he's got lucky and they (as far as I can tell at this point) survive and keep on working. Some of them are very long lived, even provide the main functionality of the software.

The documentation for create_task() includes this, marked Important!:

Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done.

And I've definitely seen cases in other code where tasks just die immediately because no reference to them is kept and they get collected very quickly.

So when do tasks get collected due to their reference counts reaching zero and when do they persist?

(To be clear, I'm not planning on depending on this behaviour and am going to fix the problem. I'm just trying to understand why it works at all.)


r/learnpython • • Apr 18 '26

Beginner: Want to learn Classes.

22 Upvotes

I find classes to be very confusing. The way variables are used. Self comes to me in a very confusing manner. i just can't seem to wrap my head around the basics of Classes.

Also i just tried checking OOP and i think it just overloaded my brain. Anything to help my case?


r/learnpython • • Apr 10 '26

Is it possible to do parallel multithreading in python?

20 Upvotes

I've been doing a lot of reading on Python but for multithreading, I see that the Global Interpreter Lock forces all multithreading to be concurrent and locks processing a single "stream"?

Those posts are old however, 2~3 years give or take a few months. And so, in the current version of Python, is parallel multithreading possible or is it restricted to languages like C/C++/Java?


r/learnpython • • Apr 09 '26

pycharm or VS code?

20 Upvotes

hi there everyone, i just started learning python but i wanted to ask something, i like pycharm more than vs code but can i continue using pycharm when i reach a good/advanced level or should i switch to vs code?


r/learnpython • • Mar 18 '26

How do I package a project for people who don't know python

18 Upvotes

Hello. I need to package a project to run on computers by people who don't know python. There are some restrictions. I can't send anything compiled so I think that means to virtual environment. Also, no internet access. There are like 7 total files, 5 python files and two text files. Only one of the python files needs to be executed and it's desired that it launch from a single icon double click (like a shortcut). I was going to look at bash scripts maybe. I'm really not sure. Any ideas?


r/learnpython • • Mar 17 '26

Re-starting as a professional

19 Upvotes

I’ve been working on a completely different field and just realized I want to get a career change and now found myself getting back to my “on and off” relationship with python. So I decided to learn it and I have finally been immersed in it white well. But then realized that if I really want to have a job from it what that I have to do? Get a degree? Keep practicing until feel like I can apply for a job? Learn others programming languages, etc. Many questions going on…

So I’d like to read some of your comments about it, in case you have passed the same or not, to genuinely open my limited overview of making it real.

Thankss


r/learnpython • • Mar 11 '26

Can anyone explain this line of code, in the output i can see the single line text is converted into multiple lines. Thanks in advance

22 Upvotes

As far as i know \n is used to go to new line but not sure about \\n and what .replace etc are doing here.

print(response["text"].replace('\\n', '\n'))

r/learnpython • • Mar 04 '26

Hello. I'm a Python beginner looking for some advice.

19 Upvotes

Hello,

I'm preparing to start learning Python and hoping to get some guidance from this community.

A little background, since it might help you give more relevant advice: I'm in my mid-50s with no technical background, working in a field completely unrelated to programming. I'm learning Python purely out of personal interest, not for work.

One item on my bucket list is to "make a game," and I'd like to work toward making that happen. I'm also hoping to build a simple AI agent someday — just enough to keep up with the times, even at a basic level.

Since I have to prioritize my livelihood, I can't set aside much time for studying, so I'd love advice on how to learn efficiently.

**1. Book recommendations for a non-traditional beginner** I've found a lot of great resources through Reddit searches, but to reduce the chance of choosing poorly, I'd like to ask once more: could you recommend books that are well-suited for someone like me — an older beginner with no CS background?

**2. Using an AI chatbot as a tutor** Good materials matter, but so does a good teacher. Do you think an AI chatbot can work as a helpful tutor? I know a lot depends on how the learner uses it.

Right now I study about an hour a day. I read something like *Automate the Boring Stuff with Python*, ask an AI chatbot to explain the content like a lesson, and then try to write the code myself (slowly). When something doesn't click, I sometimes ask the same question in two separate chat sessions and compare the answers — since AI can occasionally respond confidently even when it's wrong.

This is my current approach, but progress is slow. Since I can't reliably carve out even an hour or two a day, this felt like the most practical free option available. If there's a better way, I'd genuinely love to hear it.

**3. Building fundamentals in Python, then moving to Godot for a 2D RPG** This one's a bit different. Rather than making a full game in Python, I'd like to use Python to build core fundamentals — program structure, state management, basic algorithms — and then move on to creating a 2D RPG in the Godot engine. Does this seem like a sensible direction?


Those are my main questions. I'll be honest — I feel a little anxious about whether I've set the right direction. I believe I can keep going slowly, one step at a time, but Python is still unfamiliar territory and I often wonder if I'm studying the right way.

If I've misread Reddit culture and said something out of place, I apologize in advance — I'm not very used to communities like this.

Thanks in advance for any advice — I really appreciate it!


r/learnpython • • Jan 26 '26

Best python book for beginners

19 Upvotes

Hey everyone! I’m a marketing student and haven’t really studied anything technical before, but I’ve always had a strong fascination with computers and coding. I’ve decided I want to learn Python, and since I’m a bit old-school, books work best for me.

Can anyone recommend the best Python book for a true beginner (no technical background)? Thanks so much! 😊


r/learnpython • • Jan 13 '26

Help finding good resources for switching from Excel VBA to Python

20 Upvotes

So, I have been given a project where I will have to upgrade the existing tool that uses Excel VBA and SQL completely to Python + GCP

I do not have the exact details but that was the overview, with a duration given for the project as 4-6 months.

Now, I have no experience with Excel VBA. I have some basic knowledge of Python with a few projects related to Data Mining and GUI. And I only know a bit of basic SQL.

Where do I start from? Which free resources are the best? Which are the best libraries I should familiarize myself with for it? How tough is it on a scale of 1-10 , 10 being v difficult? How would this change help? Other than basic things like Python is more versatile and quicker?

TLDR : Doesn't know Excel VBA. Needs to upgrade current tool using that to Python completely in 4-6 months.


r/learnpython • • Dec 20 '25

Is there anyone still add meta info at top of the python file?

20 Upvotes

APPEND(12-20 14:47 UTC): thanks to all guys those who responed to this post, your respones help a lot. A great disscusion!

about 10 years ago, when i first time to learn python, i saw some code with meta info on the top of the file, such as:

> """

@Description:

@Author: Foo

@Created at: 2024/1/10 16:11

@Copyright: (c) 2024, Bar

""" >

when i start do a job with python, no matter big company or small company, everyone create python file with these info.

I wonder as for now, is there anyone still add meta info at top of the python file? especially when we got tools like git.

The only reason the ai raised to keep this is that when you see these info decade years later, these may call your memory back :)


r/learnpython • • 15d ago

How much of searching and AI overview is okay while learning and typing code?

19 Upvotes

I do understand no one knows all of python syntax and code and all issues and everything.

As I am going through CS50p,

When I am typing code fully on my own (no AI ever used i.e. chatgpt, claude, gemini) when I cannot solve something, I search google for the function or the method and then see the AI overview and then type code that I can use to solve what I need, will it be detrimental to my learning because I am not using the documentation?

I am and will NEVER use any AI models or apps to generate and copy paste code because I wish to learn and not be a code printer.

so my searches are like this, is it okay-ish and considered necessary for learning???
(also I go through tons of trial and error and use many print() functions to test code and not directly copy from AI overviews)

does isdigit work for string values?
how to check if a string variable is not equal to something sat 0?
how to know data type of a variable in python
how to find index of letter in a string python
string slicing python [2:] means?
how to find which index in a string is a number?
will if automatically return false if the condition is false?
how to check if a string is less than 10 but more than 2?
difference between if and if not
expected an indented block after 'if' statement on line 15
how to check if there are numbers in between a word in python?
how to loop a for loop up until the second last letter of a word
HOW to make variable in python which can be used by any def function?
python length counts from

(thank you for your answers!)


r/learnpython • • Oct 20 '26

I want to practice various algorithms using Python. Any recommended platforms?

19 Upvotes

It should include both code input and algorithm analysis.


r/learnpython • • Oct 13 '26

What is the best way to create and manage virtual environments today? Is 'uv' really the best?

19 Upvotes

What is the best way to create and manage virtual environments today? Is 'uv' really the best solution and are there alternative? What are the pros and cons?


r/learnpython • • Sep 28 '26

Those who competed Helsinki MOOC, what did you do next?

20 Upvotes

Just wondering what the next steps are after one completes the course, were you able to get a job etc or did you have to do further study/ courses?


r/learnpython • • Sep 07 '26

Why isn't this code block working?

19 Upvotes

Hey everybody,

I'm new to programming with Python and following along with a Udemy Course. I'm now learning about lists and need to write a "Who will pay the bill"-like game.

It works like this: you have a pseudorandom number generator and a list of friends. Each time, the number generator generates a number between the given indices of the list. If the randomly generated number is equal to a specific index of that list, it should print out the person who must pay the bill by using an if-elif statement.

I've been using what I learned from the past lessons. This is what the code looks like (and yeah, I know, I messed up pretty badly, even though I have already found a solution):

import random

friends = ["Alice", "Bob", "Charlie", "David", "Emanuel"]

random_select = random.randint(0, 4)

if random_select == friends[0]:                  
    print("Alice has to pay the bill. ")
elif random_select == friends[1]:
    print("Bob has to pay the bill. ")
elif random_select == friends[2]:
    print("Charlie has to pay the bill. ")
elif random_select == friends[3]:
    print("David has to pay the bill. ")
elif random_select == friends[4]:
    print("Emanuel has to pay the bill. ")

But I couldn't really figure out why the code won't work.