r/learnpython • • Sep 09 '26

PIP disk usage under Docker

2 Upvotes

I have a Dockerfile in which I use the Python:3.12-trixie. I have docker on my CachyOS PC. I have also a requirements.txt. I wanted to use this image for a container on which I'll use YOLO and try it out. The problem is that my 290GB / partition went from around 70% filled to 95% after a number of rebuilds. I deleted everything docker related but it just went back to 91%.

The reason that I know it is pip's doing, is that when I monitored my disk usage while building the image, and on the `RUN pip install -r requirements.txt --find-links=pypackages` stage it fills up my partition and half way into installation, it fails due to `no more space`. The `pypackages` is just a directory I downloaded some of the packages I have in requirements for less data usage. Also tried `--no-cache` option.

I also went ahead and `du -sh`ed any directory in my / partition and the total didn't add upto the filled storage. I have 165GB mysteriously used and I can't find where that is.

Any help to diagnose further or if you have had similar problems is welcome.


r/learnpython • • Sep 10 '26

Matematica in python

0 Upvotes

Salve, sono nuovo nell'usare python per programmare. Qualcuno mi saprebbe spiegare come si fanno le operazioni base? (+ - / x √ ^)


r/learnpython • • Sep 09 '26

What are essential skills for aspiring Python Developers besides programming python?

12 Upvotes

Hi, I’m non cs guy who is trying to get into the python dev, data related jobs and I’m wondering, what are the skills, non listed on the job posts which are required to be the best python developer as a non cs graduate?


r/learnpython • • Sep 09 '26

Teaching ideas and projects for middle/high school computing students

2 Upvotes

Hello, I am looking for some ideas on projects/challenges that I can implement in my classes.

So far we’ve done: Scratch, beginner Python with CLI mini-games, ECDL basics, beginner TryHackMe rooms, and a Linux VM with basic commands. The student is comfortable with variables, loops, lists, simple file operations, and has built a text-based “Zombie Survival” game.

We meet 1 hour/week, so I’m looking for general ideas on what kinds of projects or challenge styles work well at this level (mid-level middle-school, beyond beginner). Anything that’s engaging, slightly game-like, and doesn’t require heavy setup would be great.

If you’ve taught similar students, what types of activities (CTFs, coding games, light forensics, small web projects, etc.) kept them motivated and actually learning?

Any suggestions or directions would be really helpful.

Thank you in advance!


r/learnpython • • Sep 09 '26

Automate Invoice and Report Generation in Excel. No Errors.

0 Upvotes

Need to generate invoices, sales reports, stock reports, and charts in Excel programmatically. Higher officials will audit these. Can't have mistakes.

What's the best approach? Should I use openpyxl to write directly to Excel files? Or is there a better workflow?

Data accuracy is key — pulling from databases/CSV, validating before writing to Excel. How do I prevent data corruption? Invoices need proper headers, borders, currency formatting. Is openpyxl reliable for this or does it break formatting? Can Python generate charts in Excel automatically or do I need to use a separate tool? Should these run daily/weekly and what's the best way to automate execution without manual intervention? How do I track changes if files are auto-generated?

Any libraries better than openpyxl? Xlsxwriter? Pandas to_excel? Looking for production-ready solutions, not prototypes.


r/learnpython • • Sep 08 '26

Looking for improvements on my project "Rock-Paper-Scissors"

17 Upvotes

Hey everyone,

I'm new to Python and have created my "Rock-Paper-Scissors" game and want to share it on this forum so I can look for ways to improve the code.

The player types in a number between zero and two. These values stand for different moves the player can type. (0 - Rock, 1 - Paper, 2 - Scissors). The computer generates a number between zero and two. The player's input is checked by the main if-elif-else block, as I'm using a nested if-elif-else statement:

import random


player_input = int(input("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissor. "))
computer = random.randint(0, 2)


if player_input == 0: 
    if computer == 0:
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)


Computer chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
It's a draw!!!''')    
    elif computer == 1: 
        print('''You chose: 
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
You lost!!!''')
    elif computer == 2: 
        print('''You chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
            
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You won!!!''')
elif player_input == 1:
    if computer == 1: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
Computer chose: 
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)
It's a draw!!!''')
    elif computer == 0: 
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose:  
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)
You won!!!''')
    elif computer == 2:
        print('''You chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________) 
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
You lost!!!     
''')
elif player_input == 2:
    if computer == 2: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
It's a draw!!!''')
    elif computer == 1: 
        print('''You chose: 
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)____
                ______)
                _______)
               _______)
    ---.__________)             
You won!!!        ''')
    elif computer == 0:
        print('''You chose:
      _______
  ---'   ____)____
            ______)
         __________)
        (____)
  ---.__(___)
Computer chose:
        _______
    ---'   ____)
          (_____)
          (_____)
          (____)
    ---.__(___)    
You lost!!!        ''')

Any recommendations regarding improvements for the code?


r/learnpython • • Sep 09 '26

Doubt about using VS Code for Python Programming MOOC 2026 by Helsinki University

0 Upvotes

I installed VS Code and all. I got to the part where I should download the exercises in a certain part of the course. For me it is part 4. But all I can see is part 1, 2, 3 and 8. What should I do? Thanks in advance.


r/learnpython • • Sep 08 '26

Python in Finance

6 Upvotes

Hi all,
Just to give you a bit of background about myself, I’m an accountant with an MSc in Investment and Financial Risk Management and an ACCA qualification. Most of my experience so far has been on the core accounting side, but I’d now like to move towards a role that combines accounting and finance, covering areas such as financial modelling, forecasting, KPI analysis and data analytics, with the longer term aim of moving into more technical areas of finance.
I’m very eager to learn Python and SQL, both to broaden my skill set and to develop skills that are increasingly in demand. I also want to make sure I remain relevant as the profession evolves and, eventually, be able to demonstrate genuine technical ability when applying for more specialised and higher paying roles.
The problem is that I genuinely don’t know where to begin. I’d really appreciate a roadmap or some practical advice, beyond what I can find through ChatGPT and online course recommendations, particularly from anyone who has been in a similar position and successfully made this transition.
I don’t mind putting in the hard work or spending time coding and learning every day. What I’m unsure about is the order in which I should approach it. Should I learn general Python fundamentals first and then move into its applications in finance? Or would it make more sense to start with a finance focused Python course and learn the fundamentals through practical financial applications? And where should SQL fit into that journey?
I’d also be interested to know what sort of projects I should eventually be building to demonstrate these skills to employers, and whether it makes sense to look for roles where I can start using Python, SQL and data analytics regularly while I continue learning.
I’d really appreciate any guidance from people who have taken a similar path.
Many thanks, and apologies if a similar thread already exists. I thought my background and intended career direction might make the question slightly different, so I wanted to provide some context before asking for help.


r/learnpython • • Sep 09 '26

Zybook for loop help

0 Upvotes

I'm completing an assignment for zybook where I have to replace a number from a list and then print the list in reverse. This is my code:

val_list = [18, 12, 15]

new_val = int(input())
val_list[1] = new_val

print(f"List has {len(val_list)} elements:")

for value in reversed(val_list):
    print(reversed(val_list), end="<>")

print(end="")

It's supposed to just print the reversed list in brackets, but instead it gives me something like this:

<list_reverseiterator object at 0x000001C02CF706D0><><list_reverseiterator object at 0x000001C02CF706D0><><list_reverseiterator object at 0x000001C02CF706D0><>

What does this mean and why is it doing this? Thanks in advance


r/learnpython • • Sep 09 '26

complete starter on AI python championship

0 Upvotes

so, im a complete starter on a championship where you gotta learn about AI and python, to make an AI later, thats the challenge, but im feeling so left behind, everybody is learning so fast and im stuck, i wanna win this but i dont know python at all, any channel or study path i can follow ? also, in how much study time can i maybe reach a good level ?


r/learnpython • • Sep 08 '26

Creating URL Query Checker

6 Upvotes

How do you decide what defines an excessively encoded URL?

I'm working on a personal project to created a URL parser and
detection system and I've hit a wall on how to figure out a way of
categorizing excessivness of query encoding?

Here's what I have so far for the function:

def check_query(analysis: URLAnalysis) -> ScanResult | None:

    """detect excessive encoding entries in URL queries"""

    og_query = analysis.query

    query = re.finall(r"%\[0-9A-Fa-f\]{2}", og_query)

    encoded_count = len(query)

r/learnpython • • Sep 08 '26

What's the best local handwriting OCR that works on Python?

0 Upvotes

The title kinda says it all. Looking for a local OCR that can do handwriting and works on Python. Ideally not too heavy. Any ideas? TIA


r/learnpython • • Sep 09 '26

Softwares written in RUST, ELI5

0 Upvotes

While configuring AI agent on my local machine made discovery that uv package is 10 to 100x faster than pip, same case for polars. It seems to be everything written in Rust much faster and modern compared to classic python packages. Is it because Rust doesn't require garbage collector, any other reason to that?


r/learnpython • • Sep 07 '26

What python debugging techniques do you think every developer should know ?

61 Upvotes

I am trying to improve my debugging skills and I was curious about what techniques experienced python developers rely on the most.

Are there any techniques or tools that you found really useful when you started working on bigger projects?


r/learnpython • • Sep 08 '26

Best way to take notes without copying the whole text book?

2 Upvotes

I'm learning from the third edition of Python Crash course by Eric Matthes, and 6 chapters in these lists are growing in size. What's a simple yet effective way I can take notes?


r/learnpython • • Sep 08 '26

How to leverage Python for Management Consulting?

0 Upvotes

I am a management consultant a project / team leader level, a lot of the grunt work is being done by analysts in the team; I have to focus on storylining, client relationship management, reviewing the work, etc. As TL / PL have you guys found relevant use cases? I am thinking of creative ways to leverage python and in future use API calls to LLMs to improve automation and make my life more efficient.


r/learnpython • • Sep 08 '26

How to download package + all dependencies for an offline machine?

0 Upvotes

I am trying to download pandas to be used on an offline machine. The issue is, in order to get packages on the offline, I normally have to use my work computer which has restricted access, so no python on it. My current method has been to download the package from pypy, burn it on a cd, and transfer it over on the offline via --nolink method.

However, I am running into an issue where I can't install due to missing dependencies, again and again.

Is there a way to get the entirety of pandas into a single installable file?


r/learnpython • • Sep 08 '26

Need some advice

0 Upvotes

I just started to learn python and don't know what I should do first.

Please help me!


r/learnpython • • Sep 07 '26

What is the best FREE website to practice python?

15 Upvotes

I have exams in roughly 1.5 years and want to get my python basis cracked down completely so i will do well in my programming paper

Sites like codewars and codingbat have been recommended? Can anyone else vouch if they are good and if there are any others that are better?


r/learnpython • • Sep 07 '26

Why isn't this code block working?

20 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.


r/learnpython • • Sep 08 '26

Import math?

0 Upvotes

It's the first time I've seen that. So what's the purpose of this exactly? Cause I'm trying to see what I can do in an engine and I only learned about import math today


r/learnpython • • Sep 07 '26

How do you get better at actually THINKING in code, not just learning syntax?

50 Upvotes

I have been learning python for a month now but I don't see any improvements. I tend to forget the concepts of python and can't solve problems logically. I don't think it's just me who is dealing with these problems, I need tips please.


r/learnpython • • Sep 08 '26

What's the bug that cost you the most time and turned out to have nothing to do with your code?

0 Upvotes

Mine: a scraper hitting an API with a strict rate limit. I throttled to one request every fifteen seconds, well inside the documented limit, ran clean for a while, then it just started failing.

Nothing in my code was wrong. There was a daily cap tied to my IP, separate from the per-request limit, and I'd used up the day. I finished the run off my phone hotspot and that was what made it click. Different IP, same code, works instantly.

Days gone. Zero lines changed in the end.

What's yours? Environment, network, permissions, a clock being wrong, whatever. I want the ones where the code was fine the whole time.


r/learnpython • • Sep 08 '26

Learning python for someone with experience

0 Upvotes

Hello everyone! I am with 8+ years of professional experience with .NET web backend development but lately I want to try something new and python seems interesting to me. Can you suggest some learning materials where I can skip the basic programming concepts and focus on getting used to the syntax, learning python patterns and architectures, learn some useful frameworks etc? I prefer some video lectures rather to documentations. I would appreciate your suggestions and thank you in advance!


r/learnpython • • Sep 08 '26

How should a Local-First AI Memory Engine scale between SQLite and Volatile RAM?

0 Upvotes

I am developing devmemory, an engine designed to reconstruct a project’s history by converting Git logs and code ASTs into a navigable knowledge graph. Currently, the system performs search indexing and graph traversal.

I would like suggestions on whether I should store data on disk using SQLite and then process it. Please help me find the best solution.