Questions tagged [python]
Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.
15,537
questions
4
votes
1
answer
135
views
2
votes
2
answers
133
views
"Element Fusion" game where 2048 meets Chemistry
I've developed "Element Fusion," a PyGame-based game inspired by 2048 but using chemical elements. I'm seeking feedback on:
Gameplay mechanics
Code structure and efficiency
PyGame ...
5
votes
3
answers
855
views
Project Euler 127 - abc-hits
Problem (Rephrased from here):
The radical of \$n\$, \$rad(n)\$, is the product of distinct prime factors of \$n\$. For example, \$504 = 2^3 × 3^2 × 7\$, so \$rad(504) = 2 × 3 × 7 = 42\$.
We shall ...
3
votes
1
answer
96
views
matplotlib color N-slope-normalization
Based from the source code of the TwoSlopeNorm color normalization of matplotlib, I tried to implement a more general normalization that can handle any number of &...
1
vote
1
answer
92
views
AsyncSession + Transactional decorator for SQLAlchemy repository class
I have a prototype pattern for leasing sessions to a PostgreSQL database and would like a review. I took inspiration from this project on github.
...
0
votes
1
answer
73
views
Take photographs using simulated cameras that share a lock
I'm new to threading in Python. I want to use it to speed up taking images on my lab computer. I have the following dummy code:
...
7
votes
5
answers
3k
views
Check if license plate number is formatted correctly
I'm just learning Python and am looking for some feedback on some of the code exercises I've completed and do work. In particular, what would make them more Pythonic, or more closely align with ...
2
votes
2
answers
66
views
Implementing load and save operations for a text editor (proof of concept)
I have a text editor in C does not give much thought to losing data whilst overwriting the original file to save new progress. To circumvent this problem, and make the process robust, I ended up with ...
3
votes
3
answers
98
views
Determinant of matrix Python
This is an addition of my previous question Python matrix class. I've added a determinant function using Laplace expansion to my Matrix class. What I am looking for specifically is how 3x3 matrices ...
2
votes
1
answer
37
views
Maintain a log containing values if certain conditions are met
I'm trying to capture profits and set a stop loss in my trading strategy. I want the stop loss to be set daily based on the past data and if the current price, i.e., price for the date falls below the ...
2
votes
1
answer
41
views
Optimal Extraction of Longest Sorted Sequence from Individually Sorted Bucket Arrays Without Repetitions
Consider a bucket array containing sorted and/or empty buckets, and the goal is to extract the longest possible sequence in sorted order, under the following conditions:
Only one element in each ...
1
vote
1
answer
269
views
Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?
This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
11
votes
1
answer
891
views
a not-so optimized, not-so simple brainfuck source-to-source compiler to assembly (fasm) written in python that automatically compile using fasm
first time writing this source-to-source (i think) compiler, not an expert, not a pro, not an advanced person, just a beginner, I don't think this is cross platform.
...
4
votes
2
answers
656
views
Python script to auto change profiles in MSI Afterburner
I am coming from a stackoverflow question and after I hit a brick wall I tried to find a work around. I only found this working for me and work around the ...
0
votes
1
answer
52
views
Low Validation and Test Accuracy with Random Forest on ECG signals
I'm working on a project involving ECG data classification using a Random Forest model. Unfortunately, my model's performance is significantly lower than expected, and I'm struggling to understand why....