Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
5 views

I was looking at a Stack Overflow question and got somewhat carried away with improving the solution, well beyond the scope of that question. In summary, we have a string such as ...
Toby Speight's user avatar
  • 88.5k
1 vote
2 answers
70 views

Note that this is the original version which has not been formatted to comply to PEP-8 and contains an error in the code. Please visit the updated version instead to post answers, comments and/or cast ...
Chip01's user avatar
  • 413
4 votes
2 answers
641 views

I already asked this question, but the script I provided was not compliant to PEP-8, so I rewrote the script for better readability. I'm making a platformer game called Uni where this small character ...
Chip01's user avatar
  • 413
3 votes
5 answers
613 views

This code below aim to listing all folders in one directory and get size of each in byte. It uses only pathlib module for that. ...
wilfrid julien's user avatar
2 votes
3 answers
1k views

I am working on this LeetCode problem where I have to count the minimum number of operations to make all elements in an array equal to zero 3542. Minimum Operations to Convert All Elements to Zero ...
Jared McCarthy's user avatar
4 votes
1 answer
226 views

I decided to practice by modeling some simple, hand-solvable problems using z3py. Below is an example: ...
Flint's user avatar
  • 43
8 votes
3 answers
124 views

I am writing tests for legacy software which has a dependency on CGI scripts on a remote machine. Mocking the dependency would entail modifying the code under test, which is a thing I cannot do at the ...
Afelium's user avatar
  • 133
8 votes
3 answers
2k views

I'm working on a replacement for make written in Python. Instead of a Makefile, you create a Wormfile.py. This file gets imported dynamically and a Context object ...
Daniel Walker's user avatar
6 votes
3 answers
974 views

How do I optimise my code more? The goal is to have my code work with more than 200 moving balls, but that takes forever right now and doesn't look smooth at all. Furthermore, I can't get the sizing ...
Theron_Isengard's user avatar
11 votes
5 answers
911 views

I have a utility that updates, transcodes and renames audio files. Previously I used a function that simply yielded every file that was a good match (based on file extension). As some tasks can take ...
it_serf's user avatar
  • 111
2 votes
2 answers
105 views

I'm implementing a numerical solver for the 1D diffusion (heat) equation using an iterative method. The initial temperature distribution is a Gaussian profile, which should theoretically smooth out ...
PlasmaPhyscsi's user avatar
2 votes
2 answers
112 views

I'm calculating the injectors, and I've added the complete calculation code and tested it using pytest. Can you suggest a better way to structure the code so that I ...
Андрей Александров's user avatar
9 votes
4 answers
806 views

The purpose of this code is to find the smallest semiprime \$s = a b\$ satisfying a bunch of conditions stated in the Math.SE question What is the smallest "prime" semiprime?. The conditions ...
mezzoctane's user avatar
7 votes
3 answers
463 views

I wrote a function that computes the cross tabulation between two variables in a polars dataframe. It supports absolute values, row percentages, column percentages ...
robertspierre's user avatar
4 votes
1 answer
222 views

This program takes in a CSV timesheet for my current job, groups the hours worked by employee then outputs it to a txt file. I used a simple GUI with tkinter and ...
JackInDaBeanSock's user avatar
8 votes
4 answers
1k views

This program takes a user input to choose which calculation method they'd like to use, then uses a separate module and the math library to perform said calculation. I'd like some feedback as to how ...
JackInDaBeanSock's user avatar
8 votes
3 answers
756 views

I have a Github actions workflow that on pushing a tag does the following for a python package: Creates a Github release using the tag version. Publishes the package to PyPI. The package build and ...
Atharva's user avatar
  • 185
5 votes
2 answers
282 views

...
keval_07's user avatar
5 votes
2 answers
409 views

I'm creating a wordsearch generator that takes a list of words and outputs a 10x10 grid (2D array) of letters. This is roughly how it works: loop over words use boolean ...
Aya Noaman's user avatar
4 votes
1 answer
365 views

Context & Background Please let me remind you that this project may involve original research; it is important to remember that all content on this site is subject to CC BY-SA 4.0. It is a breach ...
Konchog's user avatar
  • 355
4 votes
2 answers
200 views

I wrote the Validator class. In the project, the presented code is located at the path ".../validator/init.py". It is needed for testing code in different virtual Conda environments, in the ...
Sindik's user avatar
  • 143
4 votes
1 answer
212 views

I have a telegram userbot, monitoring certain group topic and answering certain messages. I want it to be faster than human, now it's surprisingly not. But I need to speed up its reaction, any tips? <...
voipp's user avatar
  • 143
8 votes
2 answers
1k views

I am currently learning object oriented programming in Python. I attempted writing an OOP program for hangman, and while the program is functional, I just ended up writing a very long class method. ...
user30970420's user avatar
8 votes
3 answers
491 views

I have a comma-separated value (CSV) file as input, and I am supposed to interpolate all missing (nan) values based on neighboring non-diagonal values. The CSV ...
con's user avatar
  • 361

1
2 3 4 5
312