r/PythonLearning • u/Outrageous_Map_ • Oct 22 '25
r/PythonLearning • u/[deleted] • Nov 16 '25
Discussion In what ways python's code is used in mobile and desktop apps ?
r/PythonLearning • u/Majestic_Bat7473 • Sep 25 '26
Is it bad to look at videos of other people coding.
There is a pygame tutorial video online, and they code a simple platformer, but I dont want to watch the video because I am afraid it might ruin my skills. I am trying to make a tile map, but I think I did the for loops wrong or something else wrong the tiles to load up properly. It easy to twist your mind in a knot and I go around circles. I almost feel like this might be the same as vibe coding copying others.
r/PythonLearning • u/Luckyxyappy • Jun 23 '26
Help Request can someone give me an advice
i know some of python but i can't write a single code only copy paste from the coarseness
and sorry for my bad english
r/PythonLearning • u/random_observer20 • 11d ago
Python programming language problems
Hello guys ! I want to know wich are the most common problems faced by python programmers when they are coding ? (It must be a problem that isn't solved by any librarie, native or not, from python)... : )
r/PythonLearning • u/SharpScratch9367 • Jul 13 '25
Help Request Literally clueless , help pls
I don’t get why I randomly pops up whilst not being in the function (unless it is connected to the function because I still don’t understand indentation and how it connects sections of code or if it’s only connected being directly underneath a line)
pls help I’m so lost in the soup
r/PythonLearning • u/saul_soprano • Jul 17 '26
my first python
kindly give ratings and tips to improve
r/PythonLearning • u/Big_Example_3390 • Apr 25 '26
why do i feel so retarded?
help me i feel retarded. i think the proper term is tutorial hell. im dying, lost braincells, allat. i wanna learn data analysis. its been like 6 months. i get off work, come home stare at my computer and cry. thats it, i learned how to draw a star in turt and some other shi, learned basic numpy, then after that i took a month of watching the same mr p solver video to understand i didnt know anything about calculus or even really what it was. i cried for a week. studied the history of calculus, then cried. valley of thorns. horrible, bad. i know achemedies is like calculus jesus now though which is cool. fourier n allat. they were doing this shi in babylon 4000 years ago studying jupiters trajectory. i took the basic history and brain images then tried to give meaning to the linear algebra stuff and it sort of makes sense, but it felt like i just got jumped into the calculus gang newton and lui hui stomped my brains into a storm drain. i tried to use plt to transfer the data from a sheet to the code and followed along with so many tutorials that were not what i need and all said the same shi. desperately, to no avail of course. i cried again, big cup of coffee and tylenol. i just had ai to tell me that im wrong and i needed pandas. blew my mind. literally thought it from the start but never saw it in any tutorials. i didnt cry this time though. i will keep banging my head on the wall if i am not shown the doorknob. the wall will eventually break but please somebody for the love of all that is good show me the doorknob my head hurts.
r/PythonLearning • u/Salty_Date2832 • Nov 12 '25
Python code not working
What am I doing wrong? I need to define my data as regimes, which I did above, and use these regimes to compute the information ratio to the top quartile portfolio for each of the three factors in each of these regimes (3x3 numbers in total. I keep getting these outputs. I also don’t understand why it’s coming out with NaN. Can anyone please help?
r/PythonLearning • u/No_Fishing6106 • Apr 06 '26
Discussion Is it 100% viable to build Python projects using Gemini?
Opinions and experiences, please?
r/PythonLearning • u/Intrepid_Custard_877 • Jul 01 '26
Help Request How to learn python ?
Hi Guys,
I would like to learn python.
I've got zero IT or programming / coding background.
Would like to learn for free.
I'm more of a hands on learner than a theoretical learner.
Any websites that would help me learn python hands on for free ?
r/PythonLearning • u/Sea-Control77 • Nov 04 '25
What are some confusing Python concepts that took you a while to grasp?
r/PythonLearning • u/Dyformia • Jun 17 '25
What does this code do?
Warning. This is AI code, that’s why I’m asking. (I know nothing for python, hence the request).
=== rcc_core/rcc_grid.py ===
import numpy as np
class RCC_Cell: def init(self, position): self.position = np.array(position, dtype=float) self.Phi = 0.0 # Phase or some scalar field self.collapse_state = None # None means not collapsed
def update(self):
# Placeholder logic for collapse update - should be replaced with RCC physics
if self.Phi > 0.5:
self.collapse_state = True
else:
self.collapse_state = Falseclass RCC_Grid: def init(self, shape=(10,10,10), spacing=1.0): self.shape = shape self.spacing = spacing self.grid = np.empty(shape, dtype=object)
for x in range(shape[0]):
for y in range(shape[1]):
for z in range(shape[2]):
pos = (x*spacing, y*spacing, z*spacing)
self.grid[x,y,z] = RCC_Cell(pos)
def update_all(self):
for x in range(self.shape[0]):
for y in range(self.shape[1]):
for z in range(self.shape[2]):
self.grid[x,y,z].update()=== rcc_visualizer/vispy_renderer.py ===
import numpy as np from vispy import app, scene
from rcc_core.rcc_grid import RCC_Grid from rcc_visualizer.ui_controls import InputController, HoverTooltip
class RCC_VispyRenderer(app.Canvas): def init(self, rcc_grid): app.Canvas.init(self, title="RCC Simulation Viewer", keys='interactive', size=(800, 600))
self.grid = rcc_grid
self.view = scene.widgets.ViewBox(border_color='white', parent=self.scene)
self.view.camera = scene.cameras.TurntableCamera(fov=45, distance=20)
# Prepare point cloud visuals for cells
self.points = scene.visuals.Markers(parent=self.view.scene)
# Input controller and hover tooltip for modular input and hover info
self.input_controller = InputController(self.view.camera)
self.hover_tooltip = HoverTooltip(self.grid, self.view, self)
# Start timer for update loop
self._timer = app.Timer('auto', connect=self.on_timer, start=True)
self._update_point_data()
# Mouse wheel zoom factor
self.wheel_zoom_factor = 1.1
self.show()
def _update_point_data(self):
positions = []
colors = []
for x in range(self.grid.shape[0]):
for y in range(self.grid.shape[1]):
for z in range(self.grid.shape[2]):
cell = self.grid.grid[x,y,z]
positions.append(cell.position)
# Color collapsed cells red, else blue
if cell.collapse_state is not None and cell.collapse_state:
colors.append([1.0, 0.2, 0.2, 1.0]) # Red
else:
colors.append([0.2, 0.2, 1.0, 1.0]) # Blue
self.points.set_data(np.array(positions), face_color=np.array(colors), size=8)
def on_timer(self, event):
# Update simulation grid
self.grid.update_all()
# Update point cloud visuals
self._update_point_data()
# Update input-driven movement
self.input_controller.update_movement()
# Request redraw
self.update()
def on_key_press(self, event):
self.input_controller.on_key_press(event)
def on_key_release(self, event):
self.input_controller.on_key_release(event)
def on_mouse_wheel(self, event):
self.input_controller.on_mouse_wheel(event)
def on_mouse_move(self, event):
self.hover_tooltip.update_tooltip(event)if name == "main": grid = RCC_Grid(shape=(10,10,10), spacing=1.0) viewer = RCC_VispyRenderer(grid) app.run()
=== rcc_visualizer/ui_controls.py ===
from vispy import app import numpy as np
class InputController: """ Manages keyboard and mouse input for camera control. Tracks pressed keys for WASD movement and mouse wheel zoom. """ def init(self, camera): self.camera = camera self._keys_pressed = set() self.wheel_zoom_factor = 1.1
def on_key_press(self, event):
self._keys_pressed.add(event.key.name.upper())
def on_key_release(self, event):
self._keys_pressed.discard(event.key.name.upper())
def on_mouse_wheel(self, event):
if event.delta[1] > 0:
self.camera.scale_factor /= self.wheel_zoom_factor
else:
self.camera.scale_factor *= self.wheel_zoom_factor
def update_movement(self):
step = 0.2
cam = self.camera
if 'W' in self._keys_pressed:
cam.center += cam.transform.map([0, 0, -step])[:3]
if 'S' in self._keys_pressed:
cam.center += cam.transform.map([0, 0, step])[:3]
if 'A' in self._keys_pressed:
cam.center += cam.transform.map([-step, 0, 0])[:3]
if 'D' in self._keys_pressed:
cam.center += cam.transform.map([step, 0, 0])[:3]class HoverTooltip: """ Displays tooltip info about RCC_Cell under cursor. Needs access to grid and camera for picking. """ def init(self, grid, view, parent): self.grid = grid self.view = view self.parent = parent # Canvas self.tooltip_text = "" self.visible = False
# Create text visual for tooltip
from vispy.visuals import Text
self.text_visual = Text("", color='white', parent=self.view.scene, font_size=12, anchor_x='left', anchor_y='bottom')
self.text_visual.visible = False
def update_tooltip(self, event):
# Convert mouse pos to 3D ray and find closest cell
pos = event.pos
# Raycast approximation: find closest projected cell within radius
# Project all cell positions to 2D screen coordinates
tr = self.view.scene.node_transform(self.parent)
min_dist = 15 # pixels
closest_cell = None
for x in range(self.grid.shape[0]):
for y in range(self.grid.shape[1]):
for z in range(self.grid.shape[2]):
cell = self.grid.grid[x,y,z]
proj = tr.map(cell.position)[:2]
dist = np.linalg.norm(proj - pos)
if dist < min_dist:
min_dist = dist
closest_cell = cell
if closest_cell is not None:
self.tooltip_text = f"Pos: {closest_cell.position}\nΦ: {closest_cell.Phi:.2f}\nCollapse: {closest_cell.collapse_state}"
self.text_visual.text = self.tooltip_text
self.text_visual.pos = pos + np.array([10, -10]) # offset tooltip position
self.text_visual.visible = True
self.visible = True
else:
self.text_visual.visible = False
self.visible = False=== rcc_compiler/parser.py ===
from sympy import symbols, Symbol, sympify, Eq from sympy.parsing.sympy_parser import parse_expr
class RCC_Parser: """ Parses RCC symbolic formulas into sympy expressions. Supports variables: Φ, T, S, Ψ, ΔΦ, χ etc. """ def init(self): # Define RCC variables as sympy symbols self.variables = { 'Φ': symbols('Phi'), 'T': symbols('T', cls=Symbol), 'S': symbols('S'), 'Ψ': symbols('Psi'), 'ΔΦ': symbols('DeltaPhi'), 'χ': symbols('Chi'), }
def parse_formula(self, formula_str):
"""
Parses string formula into sympy Eq or expression.
Example input: 'Ψ = Φ * exp(I * ΔΦ)'
"""
# Replace Greek vars with ASCII symbols for sympy
replacements = {
'Φ': 'Phi',
'Ψ': 'Psi',
'ΔΦ': 'DeltaPhi',
'χ': 'Chi',
}
for k, v in replacements.items():
formula_str = formula_str.replace(k, v)
# Parse formula - if assignment exists (=), split LHS and RHS
if '=' in formula_str:
lhs, rhs = formula_str.split('=', 1)
lhs = lhs.strip()
rhs = rhs.strip()
lhs_expr = sympify(lhs)
rhs_expr = sympify(rhs)
return Eq(lhs_expr, rhs_expr)
else:
return parse_expr(formula_str)=== rcc_compiler/evaluator.py ===
from sympy import lambdify
class RCC_Evaluator: """ Evaluates RCC sympy formulas by substituting variable values. """ def init(self, sympy_eq): self.eq = sympy_eq # Extract variables used in expression self.variables = list(sympy_eq.free_symbols) # Lambdify RHS for fast numeric evaluation self.func = lambdify(self.variables, sympy_eq.rhs, 'numpy')
def evaluate(self, **kwargs):
"""
Evaluate RHS with variable substitutions.
Example: evaluator.evaluate(Phi=1.0, DeltaPhi=0.5)
"""
# Extract variables in the order lambdify expects
vals = []
for var in self.variables:
val = kwargs.get(str(var), None)
if val is None:
raise ValueError(f"Missing value for variable {var}")
vals.append(val)
return self.func(*vals)=== Example usage of compiler and evaluator ===
if name == "main": # Simple test for parser + evaluator parser = RCC_Parser() formula = "Ψ = Φ * exp(I * ΔΦ)" eq = parser.parse_formula(formula)
evaluator = RCC_Evaluator(eq)
import numpy as np
result = evaluator.evaluate(Phi=1.0, DeltaPhi=0.5j)
print(f"Ψ = {result}")r/PythonLearning • u/Inevitable_Low_2387 • Jun 17 '26
how can i make this program?
I need to create a Python program for a student management assignment using basic Python concepts such as lists, loops, conditionals, functions, sorting, file reading, and file writing.
The program must manage 20 students. Each student has:
Name
First exam grade
Second exam grade
The program should include the following menu options:
Add 20 students.
Sort students by:
Name (ascending)
First exam grade (descending)
Second exam grade (ascending)
Calculate and display each student's average grade and the mode of all averages.
Display all student names that contain a user-specified letter (case-insensitive).
Create a file called "notas.txt" containing:
Original name
Reversed average grade (mirror format)
Reversed name
Read and display the contents of "notas.txt". If the file does not exist, display an error message.
Exit the program.
Restrictions:
Must use basic Python.
Must use lists and functions.
I am not sure whether built-in functions such as sort(), split(), dictionaries, or external libraries are allowed.
What would be a good structure or approach to solve this assignment?
r/PythonLearning • u/The-Solo-Coder • Mar 10 '26
As a Python beginner
As a Beginner I will say Using ChatGpt to Learn Coding Basics Practice Helps A lot Try It If you are Biggner.
r/PythonLearning • u/Foreign_Band_9575 • Mar 26 '26
My code isn't outputting the right answer, and I can't figure out whats wrong.
I have two sample inputs.
1: 3, 12, 4, 10, 3, 9, 1 Output is supposed to be 3+ (this one was working)
2: 2, 8, 0, 12, 1. Output is supposed to be 1 (this one was not working)
The code is meant to output the number of "players" who have a score over 40. And if every player has a score over 40 it's supposed to output the number of players and a +.
The first number of the input is the number of players, the second is the points scored by a player and the third is fouls committed by a player. The final score of a player is calculated with this equation;
(pointsScored*5)-(fouls*3)
Any help is greatly appreciated as I really don't want to use AI to help thanks!
r/PythonLearning • u/[deleted] • May 14 '25
Help Request my friend got this error on arch trying to exit python
r/PythonLearning • u/Traditional-Poet1965 • Sep 15 '25
How do I process what I learn
This might sound very dumb, but how do I truly understand and remember what I’m learning? I’m taking two different computer science classes plus a cyber security class and I plan on going to college next year after I graduate for cyber security or computer science. How do I truly process what I’m learning. I have a kind of hard time understanding it. Is that normal?
r/PythonLearning • u/PeterParkerEarth2 • Aug 15 '25
Is learning Python as a 31 year old in 2025 worth it?
reddit.comr/PythonLearning • u/H4R5H_17 • May 19 '26
Help Request How can I learn python in the way to build Industry level softwares and tools?
I am new to python and I have the book named "Automate the boring stuff". This book is good but I still doubt "Will it actually teach me what I want to ACTUALLY learn?"
r/PythonLearning • u/ertucetin • 15d ago
Community-powered documentation and examples for Python
I'm a Clojure developer, and when I was learning Clojure about 10 years ago, I came across clojuredocs.org. I was blown away by how easy it was to use, especially when searching for examples shared by other developers. They weren't just code examples. Every developer had their own taste and perspective, which broadened my understanding of the language and how different functions could be used. I learned a lot from it.
Recently, I wanted to learn the language, but I found myself overwhelmed by its documentation. To be fair, I didn't really like it, so I decided to create something similar to ClojureDocs for Python.
Maybe building this kind of site doesn't make much sense in the age of AI, but I still think there might be a few Python developers out there who'd like to share their examples and notes, helping people who genuinely want to learn rather than asking AI for everything.
A little disclaimer: AI built this site, but the idea was mine. :)
Anyway, I built it for myself, but I hope it can be helpful to others too. It would be great to see developers sharing their code examples and helping others learn.
If you want to check it out, here's the link: https://pydocs.org
r/PythonLearning • u/[deleted] • Jun 24 '26
Help Request Can make an simple to lower intermediate app?
Hi everyone i'm new to python and it's my 4th day learning i aim for amking an app as it will help me to outstand in my scholarship so can i make an app in 2 mo ths if not complicated?