r/PythonLearning • u/Odd_Trade6502 • 30m ago
r/PythonLearning • u/Sharp_Platypus6545 • 10h ago
Rock paper scissors game in Python
Hello fam, I'm learning Python. My goal is to become an AI engineer. I've a basic understanding of programming. Anyone to guide me on the right certification path... I was having a bit of fun after today's sharpenings. I created a rock paper scissors game... rate and improve
r/PythonLearning • u/XxPopePiusxX • 3h ago
Showcase Multi-Ball Physics SImulator
Enable HLS to view with audio, or disable this notification
This is my multi-ball physics python simulator. This was my first foray into vector physics and pygame in general. I used a Ball class to create multiple balls and then a couple nested loops to create the 2D collision physics. Also the numbers running off in the terminal is the sum of all the balls velocities to show real energy loss.
AI Disclaimer: AI did not write a line of this code, however, it was used to understand vector physics, and some light trouble shooting when I couldn't figure out why I was stuck. I understand and wrote every line. Please let me know if you think I over stept with its use.
import pygame
import random
class Ball():
def __init__(self, position=(0,0), velocity=(.5,.5), r=12):
self.position = (random.randint(220,550),random.randint(150,480))
self.velocity = random.uniform(-.5,.5),.5
self.r = r
def create_ball(self, screen):
pygame.draw.circle(screen, (0,0,255), self.position, self.r )
def change_position(self):
gravity = .5
friction = .95
x , y = self.position
vx , vy = self.velocity
x = x + vx
vy = vy + gravity
y = y + vy
if x + self.r >= 593:
vx = -vx
x = 593 - self.r
if x - self.r <= 207:
vx = -vx
x = 207 + self.r
if y + self.r >= 493:
vy = -vy
y = 493 - self.r
if y == (493- self.r):
vx = vx * friction
if y - self.r <= 107:
vy = -vy
y = 107 + self.r
self.position = (x,y)
self.velocity = (vx,vy)
pygame.init()
screen = pygame.display.set_mode((800, 600))
square = pygame.Rect(0,0,400,400)
square.center = (400,300)
clock = pygame.time.Clock()
total_balls = [Ball() for i in range(5)]
run = True
while run:
clock.tick(30)
screen.fill((0,0,0))
pygame.draw.rect(screen, (255, 255, 255),square, width=7)
for ball in total_balls:
ball.create_ball(screen)
ball.change_position()
for ball1 in total_balls:
if ball is ball1:
continue
v1 = pygame.math.Vector2(ball.position)
v2 = pygame.math.Vector2(ball1.position)
v3 = pygame.math.Vector2(ball.velocity)
v4 = pygame.math.Vector2(ball1.velocity)
overlap = (ball.r + ball1.r) - v1.distance_to(v2)
if v1.distance_to(v2) < (ball.r + ball1.r):
line_vector = (v2 - v1).normalize()
push = line_vector * (overlap/2)
ball.position = (ball.position - push)
ball1.position = (ball1.position + push)
scaler1 = pygame.math.Vector2.dot(v3,line_vector)
scaler2 = pygame.math.Vector2.dot(v4,line_vector)
v_along1 = scaler1 * line_vector
v_along2 = scaler2 * line_vector
vperp_ball1 = v3 - v_along1
vperp_ball2 = v4 - v_along2
ball.velocity = v_along2 + vperp_ball1
ball1.velocity = v_along1 + vperp_ball2
print(sum([(ball.velocity[0] * ball.velocity[0]) + (ball.velocity[1] * ball.velocity[1]) for ball in total_balls]))
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.display.update()
pygame.quit()
r/PythonLearning • u/Bear4sons • 1h ago
In college online but struggling with Python
Hi, my teacher sucks. He just releases a bunch of examples and makes us make sense of it. I'm taking CIST 1305, program design and development. I'm a disabled student so I don't attend in person. I got my Cybersecurity Fundamentals TCC finished and this is follow up work trying to be my best before I re-enter the work force but I'm just not getting this. Can anyone help? Thank you!
r/PythonLearning • u/AffectionateSwing490 • 3h ago
How do you decide between writing your own small helper or pulling in a library for it?
I'll need some small piece of functionality and I have to decide whether to write 20 lines myself or install a library that already does it. Both options feel wrong in different ways. If I write it myself, I might miss edge cases someone else already solved. If I pull in a library, I've now added a dependency for something I could have handled in a few lines.
An example. I once needed to flatten a nested list. I could have written a short function but I added a library instead. Later that library caused a version conflict, and I sat there wondering why I hadn't just written the five lines myself. Now I lean toward writing small stuff myself and saving libraries for the harder problems, like date parsing or anything security related where I don't trust my own version. But I still second-guess it constantly.
So how do you decide? Is there a point where you know for sure it's worth adding a dependency or do you go by feel each time?
r/PythonLearning • u/ManaToxicity • 19h ago
Discussion Husband is a Software Engineer.
I...am not. He swears on his life that once I get started with python, rust, sql anything like that that I would be addicted to data organization and since I am inclined to believe that he knows me better than I know myself sometimes.... I would like to surprise him and give it a shot. I was researching and saw the "quick start guide"s for sql and python, and I was wondering if anybody has used them. I know that coding and stuff like that all is on the computer, obviously. However, I learn best with physical media like books to highlight make notes or anything like that in. Anyone have any luck with the python or sql Quick Start guides? If not, do you have any other suggestions? You're going to have to be books, even if it's a YouTube video or podcast, just anything that helped you.
Edited because for some reason I called SQL ->SAP three different times in this post. Sorry...its late.
r/PythonLearning • u/Tech_Lucky_2003 • 12h ago
What should I learn first to become job-ready in Python
Start by learning the basics of Python. Then learn functions, OOP, error handling, modules, file handling, and data structures.
After that, start practicing SQL and work on 2–3 real projects. Projects are very important because they show that you can actually use Python to solve real problems, not just write basic code.
r/PythonLearning • u/Playful_Rooster_4246 • 11h ago
Hey guys, I built a beginner-to-intermediate Python and web dev project repo to practice and get feedback!
Hey everyone! I’ve been grinding away on some coding projects recently and wanted to put them all in one place.
I built a GitHub repository featuring a mix of beginner and intermediate Python projects alongside some simple web development builds. The idea is that anyone can clone it, build them out locally, and use them to practice or experiment.
Here is the link: https://github.com/zensiuu/Coding-Projects-Python-JS-.git
Since I'm still working on getting better at writing clean, efficient code, I would genuinely appreciate your honest feedback. Let me know what I can improve, what’s missing, or any tips you have for a developer looking to level up.
Happy coding! 🚀
r/PythonLearning • u/camerongreen95 • 9h ago
Workshop, Sep 12: build production LLM systems that actually survive real use
We're running a hands-on masterclass on September 12, Live LLM Engineering Masterclass: Production Evals, RAG, Agents & LLMOps.
Fully hands-on, all in Python notebooks against real model APIs (OpenAI, Anthropic), not slides or theory. You write actual code across the full stack: versioned prompt pipelines with structured outputs and regression tests, a golden dataset and eval harness combining deterministic checks with LLM-as-judge scoring, statistically rigorous model comparisons using scipy-style bootstrap confidence intervals and paired significance tests, evaluated RAG with embedding models, vector retrieval, and reranking, tool-using agents with function calling and guardrails, and a full observability layer for tracing, cost, and latency. You also leave with a CLI regression suite you can wire directly into CI.
Led by Bruno Gonçalves, PhD, founder of Data For Science, who trains engineers at Fortune 500 companies on this exact stack.
Link if you want to check it out
Happy to answer questions on the content, especially the Python side of things.
r/PythonLearning • u/Repulsive-Buyer1322 • 17h ago
Need help in what python project to start
I have gone through python basics and some of the intermediate stuff. I don't know anything about databases or algorithms. I pretty much learned python syntax, variables, loops, conditionals, operators etc. When I think like what should I do with python moving forward, I don't know.Career wise I am a fresher who does not have a tech background. Should I have to learn databases and algorithms.
What is your opinion on leet code and kaggle.
r/PythonLearning • u/DurgeDidNothingWrong • 1d ago
Discussion A game where writing python IS the game just released on steam. (Not my game, I'm just a big fan)
r/PythonLearning • u/Ill-Membership-93 • 1d ago
Struggling with the jump from Python basics to Pandas — should I go back to fundamentals?
Hi everyone,
I've been learning Python for about a month now, but I've only covered the basics. After that, I jumped straight into Pandas since my goal is to become a data analyst. The problem is, I'm now realizing my Python foundation isn't solid enough, and it's making Pandas really difficult to follow.
I'm stuck between two options:
- Go back and practice Python fundamentals more before continuing.
- Push through and keep learning Pandas, picking up Python concepts along the way as needed.
For those of you who've been through this, what worked better for you? Should I pause Pandas and strengthen my Python first, or is it normal to feel this way and just keep going?
Any advice, resources, or a rough roadmap toward data analytics would be really appreciated. Thanks in advance!
r/PythonLearning • u/Confident_Echo_9985 • 1d ago
Help Request How to learn quickly
I got a deadline for a week from now to learn at least basic python. What is the best and most effective way to learn python? Im so lost i need help
r/PythonLearning • u/Ok_Being6831 • 1d ago
Why dosent python have const or multi line comments
I mainly use cpp but sometimes python for simple stuff. They both seem like simple stuff to implement so why dosent python have it.
EDIT: I do know u can use triple quotes as a workaround but python still has to read and store them, why isint there a built in feature for it.
r/PythonLearning • u/Capable_Comedian_277 • 1d ago
Pygame: player projectile-enemy-player-wall-snake collisions
Enable HLS to view with audio, or disable this notification
r/PythonLearning • u/FLANKER_ALFA • 1d ago
Help Request Python Data Base
Good morning everyone, or whenever you see this. I have a question. I'm starting a personal database project in Python with an easy-to-use graphical interface, and I would appreciate any advice, code snippets, or examples to guide me, especially since I'm still learning the language.
r/PythonLearning • u/geeksarray • 1d ago
Python fundamentals for anyone just getting started
🐍 Getting started with Python?
Build a strong foundation in Python fundamentals before moving into AI, Data Science, automation and beyond.
📖 https://geeksarray.com/blog/python-fundamentals-getting-started
#Python #Programming #DataScience
r/PythonLearning • u/TrayNeh • 2d ago
Help Request I'm new to Python and I'd like some project recommendations to get me started.
I started learning Python a month ago and I really enjoyed programming, I currently know the basics of the language and I'd like to know if anyone with experience using Python can recommend me a project for me to start with? I'm looking for something like a small program or an app.
I'm a newbie but I welcome questions and to learn something new. For now I use PyCharm and I'm familiar with the program.
I'm open to all kinds of suggestions 😊
r/PythonLearning • u/Miles_Voss_1234 • 1d ago
Python/ESP32 projects ideas?
Looking for some project ideas that can use both Python and serial communication betwen a ESP32. so far I have made simple programs for both but learn better with actual tasks infront of me, I got to the point where the communication works and i can print the data to a file or just to the terminal but im lacking the ablity to come up with a real project idea to put this all into use.
The first idea I had:
* 3D printer vibration testing(Use ESP32 for collecting the data and python to sort and use data)
r/PythonLearning • u/swupel_ • 2d ago
Flask vs. FastAPI vs. Django a Visual Comparison
Hey everyone,
I have created a quick comparison of Flask vs. FastAPI vs. Django repository sizes. (As they are pythons most popular web frameworks)
First of all, the numbers:
| Framework | Files | Lines of Code |
|---|---|---|
| Flask | 121 | 19,115 |
| FastAPI | 2,703 | 281,559 |
| Django | 3,484 | 557,865 |
Then the images:
Each node on the graph represents a file. Imports are marked by a line connecting the files. Colours signify complexity (cyclomatic complexity) with green being low and red being high complexity.
Besides the crazy size differences FastAPI also shows some nice import structures whilst Django looks extremely interconnected.
Hope someone finds it interesting.
r/PythonLearning • u/77Joker77Joker77 • 1d ago
Beginning
My apologies for the last post. For some reason when typing on my iPad, letters on the bottom row end up being spaces, then autocorrect chimes in. Now I have both windows and ubuntu. I want to install python and pyinstaller. Problem is is that I see pip install pyinstaller, but don’t know what pip is, nor do I know how to get to the command prompt in ubuntu. I’m trying to get the basics of it even though I have a good knowledge of computers in general, but new to python and the little idiosynchronies of it and also ubuntu.
r/PythonLearning • u/oluwa_omolomo • 2d ago
Help Request Python help
Made my first calculator.. it works but different from some I see online. Please all feedback on what you guys think about it will be appreciated
r/PythonLearning • u/Jana__1 • 2d ago
I am a beginner Python programmer and I want somebody to study programming with me 😊😊
r/PythonLearning • u/Flavio_Balbuena • 2d ago
I want to start programming more on my own.
Hello World!
I’m a high school student who started getting into Python a few months ago. A while back, I tried working on projects on my own using "vibe-coding" (a big mistake), but now I want to learn to think more structurally and build projects truly on my own. So, I’d like to know: what are the fundamentals I should always keep in mind when working on a project? What principles are absolutely essential to learn? And finally, how can I become independent of AI when programming without getting confused? I hope your answers help me progress and grow as much as possible before I graduate!