r/PythonLearning • u/Naive-Smoke-5977 • 5d ago
Help Request what do you think ?
i'm learning python for infraestructure this a proyect of a false resgistry of server xd
r/PythonLearning • u/Naive-Smoke-5977 • 5d ago
i'm learning python for infraestructure this a proyect of a false resgistry of server xd
r/PythonLearning • u/Big_Example_3390 • 5d ago
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 • 5d ago
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 • 5d ago
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.
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.
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/Active-Phrase-487 • 5d ago
I wanna create more projects in Python. What’s a good place to search, or a place that guides you?
r/PythonLearning • u/FeedSea1100 • 5d ago
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/Aryan_S_96 • 5d ago
r/PythonLearning • u/agentscientific_160 • 5d ago
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/Saint_augustin146 • 5d ago
Hey! So I found two different ways to learn Python and I honestly can't decide which one to go with. Don't wanna waste time on something that sucks, so figured I'd ask you all.
1) https://www.learnpython.org/
2) https://www.edx.org/learn/python/harvard-university-cs50-s-introduction-to-programming-with-python
Basically I'm trying to figure out:
I'm still kinda new to all this so I'm just looking to get the basics down. Would love to hear what people think, especially if you've tried either of these!
Thanks in advance :)
r/PythonLearning • u/Sea-Ad7805 • 5d ago
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 • 5d ago
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 • 5d ago
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 • 5d ago
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 • 6d ago
kindly give ratings and tips to improve
r/PythonLearning • u/memeeloverr • 5d ago
Looking back, what's one habit that made your code noticeably better?
Could be anything like:
I'm curious what habit had the biggest long-term payoff for you.
r/PythonLearning • u/nEo_12ts • 5d ago
"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 • 6d ago
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- • 6d ago
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 • 5d ago
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 • 5d ago
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.
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 • 6d ago
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 • 6d ago
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.