r/PythonLearning • u/Inevitable-Math14 • Jul 16 '25
r/PythonLearning • u/Correct-Tax-7514 • May 08 '26
Check my first BIG project out
Some screenshots. Im making it on my phone, cuz pygame isnt installing on my pc:(
Soo, I recently started doing my first serious project. And its a little 3d raycasting engine, like the one was used in DOOM. The controls are a bit quircky, cuz im just too lazy to make them normal just yet. I'd love to hear any feedback from yall.
r/PythonLearning • u/[deleted] • Jun 09 '25
Simple wage calculator I made tonight on my pi
r/PythonLearning • u/Limp_Tomato_8245 • Apr 02 '25
Discussion I’m back with an exciting update for my project, the Ultimate Python Cheat Sheet 🐍
Hey community!
I’m back with an exciting update for my project, the Ultimate Python Cheat Sheet 🐍, which I shared here before. For those who haven’t checked it out yet, it’s a comprehensive, all-in-one reference guide for Python—covering everything from basic syntax to advanced topics like Machine Learning, Web Scraping, and Cybersecurity. Whether you’re a beginner, prepping for interviews, or just need a quick lookup, this cheat sheet has you covered.
Live Version: Explore it anytime at https://vivitoa.github.io/python-cheat-sheet/.
What’s New? I’ve recently leveled it up by adding hyperlinks under every section! Now, alongside the concise explanations and code snippets, you'll find more information to dig deeper into any topic. This makes it easier than ever to go from a quick reference to a full learning session without missing a beat.
User-Friendly: Mobile-responsive, dark mode, syntax highlighting, and copy-paste-ready code snippets.
Get Involved! This is an open-source project, and I’d love your help to make it even better. Got a tip, trick, or improvement idea? Jump in on GitHub—submit a pull request or share your thoughts. Together, we can make this the ultimate Python resource!
Support the Project If you find this cheat sheet useful, I’d really appreciate it if you’d drop a ⭐ on the GitHub repo: https://github.com/vivitoa/python-cheat-sheet It helps more Python learners and devs find it. Sharing it with your network would be awesome too!
Thanks for the support so far, and happy coding! 😊
r/PythonLearning • u/[deleted] • Aug 19 '26
Made an email and password generator
Planning on making it save to a file that stores on the pc but for rn this is what I have
r/PythonLearning • u/easypeasycode • Sep 18 '25
What is *args and **kwargs in Python (Explained in a beginner friendly way)
Understanding *args and **kwargs in Python
Today I learned about *args and **kwargs in Python. I would like to explain it here so it might help someone else also, and I'll revise this topic again.
So, *args stands for arguments in Python, meanwhile **kwargs stands for key-value arguments in Python.
What does an Argument mean in Python?
Whenever we define any function in Python, we provide parameters to our function, using which the logic of that function will be implemented. For example:
def functionName(parameter1, parameter2):
# your function logicHere, we are providing only two parameters, so when we call our function, we must provide only two arguments.
Note:
While defining a function, the variables inside the function signature are called parameters.
When we call the function and provide values to those parameters, those values are called arguments.
So, you will call your function like this:
functionName(argument1, argument2)If you provide less or more than two arguments, you will get an error.
Sequence vs Keyword Arguments
One more important thing to notice is that these arguments should be in the same sequence as our parameters.
We also have another way of calling the function if we don't want to keep the sequence as a requirement. For example:
functionName(parameter2=argument2, parameter1=argument1)Here we specifically mentioned which parameter will take which argument value.
The Role of *args and **kwargs
Now let's come to our main topic.
Suppose while declaring the function you have no idea how many arguments you really need, or you know how many arguments you want but the list of those arguments is just too long. What can we do in that scenario is, while defining the function, we can use *args and **kwargs inside our function.
Example:
def functionName(*args, **kwargs):
# your function logicNow, while calling the function, we can provide as many arguments as we want:
functionName(argument1, argument2, argument3, argument4, argument5=parameter5, argument6=parameter6, argument7=parameter7)If you notice, you can see we are passing both normal arguments as well as key-value arguments:
The normal arguments will take the place of *args.
The key-value arguments will take the place of **kwargs.
It’s not mandatory that you name your arguments as args or kwargs. The difference is:
If we are using *, this means that we are expecting one or more arguments at that place.
If we are using **, this means that we are expecting one or more key-value arguments at that place.
How Python Stores Them Internally
All the arguments passed for the *args get stored as a tuple.
All the key-value pair arguments get stored as a dictionary and take the place of our **kwargs.
Keeping in mind this internal storage of the above arguments, we can access the values and write our logic.
Thanks for reading this till the end 🙏 Yes, I have used GPT to correct only the grammar mistakes; the rest of the explanation part has been done by me. If you liked this explanation, please comment if I should post any new learning like this on this sub.
r/PythonLearning • u/Samar__Upreti • Jul 20 '26
Day -1 With Flask (any suggestions)
Build Projects With Me
r/PythonLearning • u/Sea-Ad7805 • Nov 14 '25
Python Data Model: Copying
An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:
r/PythonLearning • u/Mohamad-Rayes • Jun 29 '25
Discussion Why a lot of programmers like Linux more than windows or mac
I am using windows for python but I see a lot of programmers like Linux more windows, does it faster ? or what
r/PythonLearning • u/Commercial-Paper749 • Sep 02 '26
What's wrong with my code?
What's wrong with my code?
New to learning
Following the youtube video from bro code
Was trying to implement my own stuff into this by using loop
Update: it's working now thankyou guys
r/PythonLearning • u/Acceptable_Simple877 • Aug 16 '25
Beginner, been learning off and on for a little bit, Made this project
r/PythonLearning • u/Money-Rare • Feb 22 '26
Showcase 4000 lines of code later i finally finished(well, until a new problem pops up) my first ever python application
I managed to convert it into an executable file with directory and then made a setup file. Last 3 photos were made before the personalization of the output window. In the editor it's possible to draw a mechanical system composed of disks, carts,rods, connected by ropes, springs, dampers(linear and non linear), coulomb friction can be applied to nodes, three kinds of input force(constant, pulse, periodic), two kinds of output(displacement and rotation). all mass items and grounds are draggable and deletable. Mass items are fully customizable,for disks you can choose mass and radius, for rods mass, direction, number of segments, lenght of segments for both center of rotation, for cart direction and mass, of course dimensions affect item appearance as well on canvas. Output window shows one plot if no non linear dampers are present, and three if there are, in both cases overshoot and max response are evaluated and printed. It works for any number of degrees of freedom, dampers are also all indipendent so each damper can have it's own value/table of values. Canvas and data can be saved and loaded from json files. Quite interesting learning experience.
r/PythonLearning
•
u/GrowthSwimming6208
•
May 16 '26
Discussion New to python. How to improve this simple build
As the title states. How would you improve this code? I’ve only been doing python for a good 4 weeks. It’s from a simple class assignment for a log in requiring a username, password and security code
r/PythonLearning • u/ibuggle • Mar 29 '26
Python script for incompressible flow simulation
Here i give you the code for CFD simulation from scratch you wan play with. You must install NumPy and OpenCV. The simulation is incompressible and inviscid so no supersonic flow. The resolution is in 720p and needs 30 minutes to calculate. It uses CPU not GPU so here's the code:
import numpy as np #NumPy required
import scipy.ndimage as sn #Scipy required
import cv2 #OpenCV required
import time #To count the remaining time before the end
import os #To clear the console
Ny=720 #Resolution, warning heavy: 144 320 480 720 1080
Nx=int(Ny/9*16) #In 16/9
radius=Ny/20 #Obstacle radius
xcenter, ycenter = Ny/2, Ny/4 #Obstacle position
Y, X = np.ogrid[0:Nx, 0:Ny] #2D arrays for position
objet = np.zeros((Nx,Ny), np.uint8) #Obstacle intialisation
square_dist = (X - xcenter) ** 2 + (Y - ycenter) ** 2 #Distances from the circle position for calculation
mask = square_dist < radius ** 2 #Obstacle binary (Is in the object?)
objet[mask] = 1 #Obstacle field definition
boundaries= np.zeros((Nx-2,Ny-2), np.uint8) #array used in boundaries position
boundaries=np.pad(boundaries,1,mode="constant", constant_values=1) #frame for the boundary array, filled of ones
Lx=1 #Size of the world
Ly=Lx*objet.shape[0]/objet.shape[1] #Flexible size shape
dl=Lx/Nx #differential in lengh for finite gradients (dl=dx,dy)
rho=1.3 #density of air, no mu inciscid
vsim=10 #number of steps between frames , warning heavy
v=1 #fluid speed at the infinite
dt=Lx/(Nx*v*10) #deltatime for one step (0.1x the speed of the grid)
Nt=4000*vsim #Total number of steps (warning heavy)
vx=np.zeros((Nx,Ny)) #Initialisation of fields, vx, vy pressure
vy=np.zeros((Nx,Ny))
p=np.zeros((Nx,Ny))
vx[objet==0]=v #speed inside the obstacle at zero
def median(fa): #median filter to avoid numerical crash on (DNS)
faa=sn.median_filter(fa,3) #smallest median filter
return faa
def gradx(fx): #gradient in x
grx=np.gradient(fx,dl,axis=0,edge_order=0)
return grx
def grady(fy): #gradient in y
gry=np.gradient(fy,dl,axis=1,edge_order=0)
return gry
def advection(vxa,vya): #advection
gradxvx=gradx(vxa) #all vx and vy gradients
gradxvy=gradx(vya)
gradyvx=grady(vxa)
gradyvy=grady(vya)
vgradvx=np.add(np.multiply(vxa,gradxvx),np.multiply(vya,gradyvx)) #vgradv on x
vgradvy=np.add(np.multiply(vxa,gradxvy),np.multiply(vya,gradyvy)) #vgradv on y
vxa-=vgradvx*dt #update in x and y
vya-=vgradvy*dt
return 0
def pressure(vxa,vya,pa): #pressure calculation
gradxvx=gradx(vxa) #gradient to calculate v divergence (no compression)
gradyvy=grady(vya)
pnew=(np.roll(pa,1,0)+np.roll(pa,-1,0)+np.roll(pa,1,1)+np.roll(pa,-1,1))/4-(rho*dl**2)/(4*dt)*(gradxvx+gradyvy) #poisson solver for pressure
return pnew
def gradp(vxa,vya,pa): #pressure gradient calculation
vxa-=dt/rho*gradx(pa)
vya-=dt/rho*grady(pa)
return 0
t0=time.time() #start counting time to follow simulation progression
t1=t0
sec=0
for it in range(0,Nt): #simulation start
advection(vx,vy) #solving navier stokes: advection, pressure, and pressure gradient (inviscid)
p=pressure(vx,vy,p)
gradp(vx,vy,p)
if it%10==0: #median filter to fix finite differences
vx=median(vx)
vy=median(vy)
p=median(p)
vx[objet==1]=0 #zero speed in the obstacle
vy[objet==1]=0
vx[boundaries==1]=v #boundaries conditions as infinite values
vy[boundaries==1]=0
p[boundaries==1]=0
if it%vsim==0: #plot
data=np.transpose(np.add(1.0*objet,.9*np.sqrt(((vx-v)**2+vy**2)/np.amax((vx-v)**2+vy**2)))) #plotting (v-v_inf)^2
cv2.imshow("Sim", np.tensordot(sn.zoom(data,720/Ny,order=0),np.array([1,.7,.9]),axes=0)) #display in the window
cv2.imwrite('Result/%d.png' %(it/vsim), 255*np.tensordot(sn.zoom(data,720/Ny,order=0),np.array([1,.7,.9]),axes=0)) #save figure in the folder "Result", must create the folder
cv2.waitKey(1) #waitkey, must have or it will step only typing a key
pourcent=100*float(it)/float(Nt) #avencement following in console
t1=time.time() #time measurement
Ttravail=np.floor((t1-t0)*float(Nt)/float(it+1)) #total work time estimation
trestant=Ttravail*(100-pourcent)/100 #remaining time estimation
h=trestant//3600 #conversion in hours and minutes
mi=(trestant-h*3600)//60
s=(trestant)-h*3600 - mi*60
if (int(t1)>(sec)): #verbose simulation progression
os.system('cls' if os.name == 'nt' else 'clear')
sec=int(t1)
print('Progression:')
print('%f %%.\nItération %d over %d \nRemaining time:%d h %d mi %d s\nSpeed: %d m/s \nProbability of Success %f' %(pourcent,it,Nt,h,mi,s,np.amax(vx),(1-(v*dt)/dl)))Tell me if it's working for you or if i made an error somewhere. I'm using the IDE Spyder and my os is Archlinux. Feel free to ask questions or to answers other's questions to help each others. Would you like me to make a step-by-step tutorial?
r/PythonLearning • u/[deleted] • Mar 24 '26
Day 12: Turning Logic into Systems 🛠️
It’s 1:54 AM, and the terminal finally gave me the answer I was looking for.
Tonight’s build for my "LifeOS" suite: ExpenseOS.
I moved beyond simple logging into real-time data analysis. The challenge wasn't just writing to a file; it was the structural logic of reading that data back and making it make sense.
Key Technical Wins tonight:
Data Persistence: Built a robust
.txtdatabase using pipe-delimited structures.Dictionary Logic: Solved the "Overwrite" bug by implementing membership checks—ensuring categories like 'Travel' and 'Food' accumulate accurately.
Whitespace Management: Mastered
.strip()to ensure date-based filtering actually works (trailing spaces are the silent killers of logic!).
The Result: 💰 Total Today: ₹70,650 🚗 Top Category: Travel
The transition from Project Manager to Technical Builder is happening one late-night "Aha!" moment at a time.
#Day12 #Python #BuildInPublic #ProjectManagement #CodingJourney #ProductOps
r/PythonLearning • u/Puzzleheaded_Ice7400 • Mar 20 '26
I want someone to learn with
I recently started to lean coding and I chose python it’s getting more challenging and I was thinking if anyone wanted to lean with me or guide me it will be much more fun
r/PythonLearning • u/ilikeraspberries123 • Aug 26 '25
Project - Password Analyzer
Topic - Project on what I've learnt so far
Hi all! Just finished this project which includes everything that I've learnt so far. Took 2/3 days but got there, honestly I'm really happy that I started it. I haven't included anything such as dictionaries yet (will be studying them next) but tried to include as much of lists and tuples I could. Any feedback would be highly appreciated as always, would love to hear others solutions to certain areas.
Thanks!
r/PythonLearning • u/Electronic_Mine6521 • Jul 11 '25
my first project
I started python two weeks ago and this project , it s a close to RSA encryption , i m new to this so if you have any advice for making it more efficient i would love help .
r/PythonLearning • u/Background_Cut_9223 • Jun 01 '25
Learned Image Processing using OpenCV
I was just learning opencv and tried to make live ASCII art in terminal from video
r/PythonLearning • u/COLLLOrs • Jun 06 '26
I finished My multi-tool project
Here is the link to the Github page : https://github.com/Colors-Dot600/Multi-Tool
There is a Clock, a Timer, A To-Do list and a Password Generator/Manager