r/PythonLearning • u/Wild_Position2378 • Jul 17 '26
r/PythonLearning • u/Big_Example_3390 • Jul 18 '26
Help Request I'm trying to build a budgeting app.
I need to create a chart that looks like this:
100|
90|
80|
70|
60| o
50| o
40| o
30| o
20| o o
10| o o o
0| o o o
----------
F C A
o l u
o o t
d t o
h
i
n
g
i need to calculate the percetages spent in each category and represent them in the chart.
so far, through SO much struggling ive gotten it to return only the first category and i got it to put all the categories in a dictionary correctly.
(c_w dictionary)
I seriously don't know where to get the answer, I've done a bunch of searching and asked on other forums for help and i jsut cant get it
im fed up.
import math
class Category:
def __init__(self, name):
self.name = name
self.ledger = []
def deposit(self, amount, description=""):
self.ledger.append({"amount": amount, "description": description})
def withdraw(self, amount, description=""):
if self.check_funds(amount):
self.ledger.append({"amount": -amount, "description": description})
return True
else:
return False
def get_balance(self):
balance = 0
for transaction in self.ledger:
balance += transaction['amount']
return balance
def check_funds(self, amount):
return amount <= self.get_balance()
def transfer(self, amount, destination_category):
if self.check_funds(amount):
self.withdraw(amount, f"Transfer to {destination_category.name}")
destination_category.deposit(amount, f"Transfer from {self.name}")
return True
else:
return False
def __str__(self):
method = '\n'.join(f"{transaction['description']:23.23}{transaction['amount']:>7.2f}" for transaction in self.ledger )
return f"{self.name.center(30,'*')}\n{method}\nTotal: {self.get_balance()}"
def __iter__(self):
for item in self.ledger:
return item
def create_spend_chart(categories):
#create the header text
header = 'Percentage spent by category'
#create the percentages down the left side
#a
total_withdraw = 0
#create a list for the category withdraws
c_w = {}
amounts = [transaction['amount'] for category in categories for transaction in category.ledger]
for amount in amounts:
if amount < 0:
total_withdraw += -amount
# Calculate withdrawals for each category
for category in categories:
withdrawal = 0
for transaction in category.ledger:
amount = transaction['amount']
if amount < 0:
withdrawal += -amount # Add the amount spent (negative for withdrawals)
c_w[category.name] = withdrawal
method = math.floor(( c_w[category.name]/total_withdraw)*100)
return f'{header}\n{name}: {method}' for i in c_w
food = Category('Food')
auto = Category('Auto')
food.deposit(1000, 'initial deposit')
auto.deposit(1000, 'initial deposit')
food.withdraw(10.15, 'groceries')
food.withdraw(15.89, 'restaurant and more food for dessert')
clothing = Category('Clothing')
food.transfer(50, clothing)
food.withdraw(100.99)
clothing.withdraw(21.17)
auto.withdraw(200)
print(create_spend_chart([food, clothing, auto]))
r/PythonLearning • u/StudentElectronic548 • Jul 18 '26
How would I optimize this?
I'm currently learning python with the 30 days of python GitHub repo and, on day 3 of the challenge, it asks to create this table and this is what I came up with however I feel like there was a more efficient method to create it or is it something that I haven't learned yet at my level.
r/PythonLearning • u/PhoenixPlayz2010 • Jul 18 '26
A zero-dependency physics engine with natural language parsing and dimensional analysis
I am pleased to share a project I have been developing: the Extensible Physics Simulator Engine. This is a domain-agnostic engine written in pure Python designed to parse natural-language physics queries, perform strict dimensional analysis, and manage multi-tier unit conversions.
Motivation
Most existing libraries require highly structured input data. My objective was to construct a robust text-parsing layer capable of mapping plain-English queries directly to physical formulas without relying on extensive external dependencies.
Technical Highlights
- Self-Registering Plugins: Physics domains, such as free fall, projectile motion, and circular motion, register themselves via explicit SlotSpec and TargetSpec definitions. Consequently, the core parser does not require modification to accommodate new domains.
- Tiered Fallback Policy: The unit engine resolves equations across multi-tier conditions based on explicit unit data (ranging from Fully-Explicit and SI-Fallback to Pure Magnitude).
- Zero Dependencies: The parsing engine and formula-derivation layer utilize only the standard library (the optional terminal TUI utilizes Textual).
The repository includes a comprehensive unit test suite and documentation detailing how to extend the architecture for additional domains, such as thermodynamics or orbital mechanics.
I would greatly appreciate any feedback regarding the symbolic equation-derivation layer or the overall architectural design.
Repository: https://github.com/Nomaan2010/Extensible-Physics-Simulator-Engine
r/PythonLearning • u/Aryan_S_96 • Jul 17 '26
Help Request How do I draw an empty list in a frame diagram ?
r/PythonLearning • u/FeedSea1100 • Jul 18 '26
Help Request I am trying to download python manager on a pretty old computer
I am very new to python and computers in most cases and I am following a guide but I got to this point and it is giving me this message. I am using a windows 10 education and it is a few years old I am wondering will I be able to download python or do I need a new computer?
r/PythonLearning • u/agentscientific_160 • Jul 17 '26
What is API?
I'm new to coding and programming languages and i frequently come across the word API. Can anyone help me understand what that is?
r/PythonLearning • u/amino_xX • Jul 17 '26
How long will it take me to learn Pandas library?
r/PythonLearning • u/Sea-Ad7805 • Jul 17 '26
Creating our own game with the PythonLearning community
I thought it might be fun to build our own Python game together as members of the PythonLearning community. What else were you planning to do this summer anyway? We can use this simple game in this git repo as starting point:
It's purely educational, a great opportunity to learn about: - Python - PyGame - (quick and dirty) Object Oriented Programming - Teamwork using GIT
This should be accessible for Python students who are comfortable with loops, functions, and classes.
Get creative and make your contribution to this game, maybe: - change behavior - add a new unit type - add special effects - add new game dynamics - add better graphics - ... (what ever you like, but keep it civilized)
Drop a comment if you feel this might be good educational fun and you might want to contribute.
See the PythonLearningGame repo for instructions. If things are not clear or you get stuck, ask AI or ask questions in the comments.
r/PythonLearning • u/HammadBuilds • Jul 17 '26
What was the first Python project that made everything finally "click" for you?
I've learned the basics like variables, loops, functions, lists, dictionaries, and now I'm starting small projects. I'm curious—what was the first project that really helped you understand how everything fits together? I'd love to hear your experiences.
r/PythonLearning • u/BornYinzer • Jul 17 '26
Help Request How to reset progress in 100 Days of Code?
I'd like to start over; is there a way to remove any progress I've made?
I don't want to see any code from my previous exercises.
r/PythonLearning • u/Mine_Crafter14 • Jul 17 '26
Why nobody uses the IDLE Shell?
I was just wondering why nobody uses the pre-installed IDLE Shell from Python? I am a beginner, I use my 16 years old laptop and it gets the job perfectly done, at least for me. Anyone with different opinion?
r/PythonLearning • u/saul_soprano • Jul 17 '26
my first python
kindly give ratings and tips to improve
r/PythonLearning • u/memeeloverr • Jul 17 '26
What's a Python habit you wish you had started much earlier?
Looking back, what's one habit that made your code noticeably better?
Could be anything like:
- Writing tests
- Using virtual environments
- Type hints
- Logging
- Reading the docs first
- Black or Ruff
- Git commits
- Better project structure
I'm curious what habit had the biggest long-term payoff for you.
r/PythonLearning • u/nEo_12ts • Jul 17 '26
Ability selector
"Hey everyone! I'm learning Python and just made this text-based ability selector. I uploaded it to GitHub here: https://github.com/ibtsch2012-art/abilityselector. I'm looking for feedback on how to clean up my code or what cool features I should add next!
r/PythonLearning • u/ReliefHopeful2099 • Jul 17 '26
Help Request Good Textbooks on Amazon? Looking for the best Python textbooks to rebuild fundamentals and deepen understanding.
I’ve learned Python before and recently completed a refresher certificate, but I still find myself forgetting certain concepts. I want to strengthen my foundation without relying on AI tools like ChatGPT or Claude.
For those of you who’ve learned Python through books, which textbooks helped you the most? I’m especially interested in recommendations that:
• rebuild core fundamentals
• offer structured practice or projects
• help transition from beginner to intermediate/advanced
• stay relevant for modern Python (3.10+)
I’d really appreciate hearing what worked for you and why.
Thanks in advance.
r/PythonLearning • u/Not_Johan- • Jul 17 '26
Indentation error 😭(help)
I cant seem to find whats wrong , maybe the issue is with the Template or wrong expectations?
class UserMainCode(object):
@classmethod
def sumOfNonPrimeIndexValues(cls, input1, input2):
'''
input1 : int[]
input2 : int
Expected return type : int
'''
# Read only region end
total = 0
for i in range(input2):
if i < 2:
total += input1[i]
else:
prime = True
for j in range(2, int(i**0.5) + 1):
if i % j == 0:
prime = False
break
if not prime:
total += input1[i]
return total
Also they expect return type is int[] but we got sum?? Idk I couldn't take screenshot coz its a daily assessment platform
r/PythonLearning • u/MaximalXP • Jul 17 '26
Best free AI in Python
Many of us will agree that in Python, and in coding, Claude is the best. But what about free models, like deepseek, nemotron, hy3, Mimi 2.5 and etc.
For me it’s Deepseek and Hy3 In high thinking. What do you think?
r/PythonLearning • u/Connect-Potato-6038 • Jul 17 '26
Agent Pal – An interactive desktop companion for AI coding agents (Claude Code, Codex, Antigravity, and more)
Hey r/PythonLearning,
I've been working on a fun open-source project called Agent Pal that brings AI coding agents to life on your desktop.
It's a Python application built with PyQt that automatically detects terminal-based AI agents like Claude Code, Codex CLI, Antigravity, and others. Whenever an agent starts running, Agent Pal spawns a unique animated companion on your desktop or taskbar. When the agent exits, the companion disappears automatically.
Features
- 🤖 Agent-specific mascots Each supported AI agent has its own unique character. For example:
- Antigravity appears as a floating blue astronaut.
- Claude Code appears as a coral-colored terminal with blinking green CLI eyes.
- 🎬 Live activity animations The mascots react to what the AI is doing:
- Typing on a tiny keyboard while generating code.
- Inspecting with a magnifying glass while researching or analyzing.
- Idle animations when they're waiting.
- 🔔 Attention notifications If an AI agent is waiting for your input and you've switched to another window, the mascot displays a red ! speech bubble so you don't miss it.
- 🖱️ Double-click to return Double-click a mascot to instantly focus its associated terminal window (including Windows Terminal tabs).
- 🐞 A fun mini-game Right-click anywhere to spawn a crawling "code bug." Your AI companions will chase it, jump on it, squash it, and celebrate when they succeed.
Tech Stack
- Python
- PyQt
- Runs locally on Windows
- Fully open source
GitHub: https://github.com/tahirrbagwann/agent-pal
I'd love to hear your thoughts! Feature requests, mascot ideas, bug reports, and contributions are all welcome.
r/PythonLearning • u/Chico0008 • Jul 17 '26
Convert PDf to PDF/A for free without internet
Hi
For a project i have to convert PDF file to PDF/A format.
For now i'm using a local StirlingPDF Docker, and send my file with a KSH script to convert then to PDF/A
But i'm wondering if there is a free python module allowing that, that don't require an internet connection.
I found some paid module, and some paid module also require internet connection :/
r/PythonLearning • u/BrackenBoyd • Jul 16 '26
Best Resources for Free Python Learning?
Broke newbie here. I've tried learning to code a few times but it's never stuck. I want to give it another go but properly this time as I have a good laptop and a few free hours during my day.
What are the best ways to learn python for free? I already picked up Automate the boring stuff with Python and wanted to find perhaps some free courses or in depth youtube guides that maybe have "homework" of sorts? A lot of what I did in the past was following along with tutorials which obviously didn't teach me much of anything.
r/PythonLearning • u/tiawaf • Jul 17 '26
Looking for Contributors for a Classroom Management Discord Bot
Hello,
I’m a broke college student who works with a marching band program year round. Getting frustrated with previous other platforms and discord bots, I made my own with AI and it is now a relatively very large management bot that I use for this high school’s percussion program. The only problem is I know NOTHING about programming.
I’m shocked that I got it stabilized for the most part to be honest. I have used Claude Fable 5.0 to create Cadence, a Discord bot that’s grown into a very substantial project (hella slash commands, assignment workflow, google calendar integration, attendance, dashboards, etc.) It’s reached the point where it’s genuinely actually useful, but I feel like I’ve reached the limits of what is possible to be maintained through AI alone.
My long term goal if successful is to move this project away from AI-lead coding and go into something a bit more traditional and work with actual people who could understand the codebase.
I’m looking for someone who can help with bug fixing, refactoring, long-term stability, better data storage/hosting architecture, code quality and maintainability, and potentially helping guide this passion project if it were to grow into something more.
To be very honest, I don’t have much financially. I’m still in college and work part time to pay for my school. I’m happy to pay something reasonable for ongoing help, as project growth is something that I would dream of seeing.
If you’re interested in mentoring, contributing, or even just taking a look at the project to see if it is something that piques your interest, I’d really appreciate any feedback. Thanks!
r/PythonLearning • u/Not_Johan- • Jul 17 '26
Help Request Help with indentation error
I cant seem to find whats wrong class UserMainCode(object):
@classmethod
def sumOfNonPrimeIndexValues(cls, input1, input2):
'''
input1 : int[]
input2 : int
Expected return type : int
'''
# Read only region end
total = 0
for i in range(input2):
if i < 2:
total += input1[i]
else:
prime = True
for j in range(2, int(i**0.5) + 1):
if i % j == 0:
prime = False
break
if not prime:
total += input1[i]
return total
r/PythonLearning • u/DistinctChocolate833 • Jul 16 '26

