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,725 questions
Score of 4
3 answers
93 views
Interactor, controller and presenter for searching accounts on different social networks
I am learning Сlean Architecture, and for practice, I am writing a Python program for searching accounts on different social networks.
I am write interactor for search accounts:
...
Score of 5
4 answers
898 views
Python script that evaluates any math function at 10000 points
I have a Python script that calculates any math function between two intervals at n number of points. It also handles singularities of the function. This is part of ...
Score of -1
1 answer
62 views
Instantiating a Python class based on an enum value [closed]
In my current code, I need to create an instance of one of two classes based on the value of an enum. I want to do this in a way that optimally balances readability, maintainability, and conciseness. ...
Score of 3
1 answer
179 views
Is my SDENet re‑implementation faithful to the paper? A discrepancy in non‑trainable parameters
I am re‑implementing SDENet (Lightweight SDENet Fusing Model-Based and Learned Features for Computational Histopathology, IEEE JSTSP 2024) because the authors did not release code and the paper does ...
Score of 1
5 answers
629 views
Stack Overflow Challenge 20: We all scream for Ice Cream!
There is a new challenge on Stack Overflow:
Challenge 20: We all scream for Ice Cream!
Instead of posting my code there, I decided to post it here for a review. I can not see any of the other replies ...
Score of 4
5 answers
461 views
An Implementation of a Mathematical Expression Postfix Parser
I made a Python script that outputs a result when a mathematical expression is entered. So for instance: when entered "2+4(8)", it will output 34. The script also supports functions, like ...
Score of 3
2 answers
363 views
Arithmetic calculator from the command line
I am new to Python. I'm trying too understand how to improve my arithmetic calculator code. What do you think I need to improve on my code?
...
Score of 6
3 answers
406 views
Score of 7
4 answers
473 views
Equation optimizer based on operation costs (2)
This is the follow-up of Equation optimizer based on operation costs
I have modified a lot since then and even improved accuracy and performance.
...
Score of 7
3 answers
424 views
Genetic Algorithm to maximize a function over a constrained search space
In my first year after just learning Python I wrote a genetic algorithm to maximize the function f(x, y, z, w) = w^3+x^2-y^2-z^2+2yz+3wz-xy+2 over a small search ...
Score of 8
5 answers
843 views
Automate the initial steps of a Python project
I've created this script to automate the initial steps of creating a Python project. Those are:
Create a project folder
Create a virtual environment
Update the packet manager - I am using pip
Install ...
Score of 4
4 answers
424 views
Equation optimizer based on operation costs
I wrote this code to split a number into equations which gives the least cost.
e.g. 6896 = (64 + 19) ** 2 + 7 which has a cost of 1.909 points which is the most optimized equation with least cost.
The ...
Score of 4
2 answers
287 views
Storing functions for easier testing and mock API data for testing
Project collects football data from external API.
...
Score of 5
4 answers
498 views
Python retrieve iterate over all sub-modules and sub-packages
So I wanted to print all submodules of my package today and as usual I googled if someone else shared a way and indeed there was a stackoverflow Q&A. However all of the code in the answers didn't ...
Score of 6
3 answers
424 views
Translate Roman numerals to integer: (Final) Part 3
I've heard y'all and tried my best to work in all of the suggestions.
There are a few upgrades.
With your help I was able to cut the time for round_trip to 1/5. (...