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,705 questions
3
votes
4
answers
127
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 ...
3
votes
2
answers
351
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?
...
6
votes
3
answers
393
views
7
votes
4
answers
468
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.
...
7
votes
3
answers
411
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 ...
6
votes
4
answers
794
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 ...
4
votes
4
answers
385
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 ...
4
votes
2
answers
275
views
Storing functions for easier testing and mock API data for testing
Project collects football data from external API.
...
5
votes
4
answers
466
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 ...
6
votes
3
answers
409
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. (...
7
votes
6
answers
638
views
Translate Roman numerals to integer: Part 2
I've updated the code with most of your suggestions.
I choose enum.Enum over dict and stuck to computing the values instead of ...
7
votes
4
answers
730
views
Translate Roman numerals to integer
I've made a little script to convert from roman-numerals to integer.
What do you think?
...
7
votes
7
answers
1k
views
Password checker
I would like a review of my code. It's a very simple code that checks the strength of a password.
...
4
votes
4
answers
385
views
Function that searches a substring on an iterable, also with different types of return and ways to search
I was making a program that created several words in a list, and this made me think about trying to create a function that takes the closest words to a certain target, returning all the correct ...
8
votes
5
answers
777
views
Fibonacci - Memento pattern with recursion and some utilities
The code below implements the memento-pattern and is demonstrated on a fibonacci-sequence.
So far, nothing special. However, while I was writing the code I thought some utilities will be nice.
After I ...