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,569 questions
4
votes
1
answer
136
views
CSV TimeSheet Calculator
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 ...
5
votes
4
answers
1k
views
A function that opens a CSV file
I'm working on a project that requires me to open CSV files. It must check that the file is open and then return it to main. I've written a function to do so and would like to know how it looks, if ...
8
votes
4
answers
937
views
Python implementation of core fundamentals to calculate math arithmetic
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 ...
5
votes
4
answers
560
views
Basic word search puzzle generator
This is code for a basic word search puzzle generator (also "wordsearch"). The code:
Creates a 10 x 10 grid of letters.
Words are hidden somewhere in the grid, horizontally or vertically.
...
8
votes
3
answers
714
views
Github actions workflow for release and publishing to PyPI using uv
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 ...
6
votes
3
answers
655
views
Interactive simple calculator as a first project. As of now it handles arithmetic, linear and quadratic calculations
This is my very first personal project. I'd like to know what I can improve in this code, with reference to optimization and efficiency.
Here's the code:
...
5
votes
2
answers
226
views
10
votes
3
answers
2k
views
A Rubik's Cube game in Python
I implemented this Rubik's Cube game in Python, using Canvas and Context2d for user interaction. This was mainly an exercise in &...
5
votes
2
answers
374
views
Wordsearch Generator (Tracking Success/Failure)
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 ...
4
votes
1
answer
790
views
Using AI agent to solve the N-puzzle
I have just written this code here. The code is about creating a (local LLM based) AI agent to solve the N puzzle. I should stress that I am the one who wrote the code, and I did not use AI to write ...
4
votes
1
answer
356
views
Half-hexagon neighbour identification under (novel) hierarchical hexagonal grid
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 ...
4
votes
5
answers
735
views
Password storage with gatherer plugin in Python
First the PasswordStore, which is pretty straight-forward. It stores title-password association, but it is important that a title can have multiple passwords.
The <...
4
votes
2
answers
189
views
Class for validating code in different Conda environments with PyTorch
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 ...
9
votes
3
answers
1k
views
Repository with SQLite in Python
This repository class is supposed to be used for saving information extracted from RAR, SFV archives or files that contain the hash sum in their filenames.
The abstract parent class can be found here)....
4
votes
1
answer
196
views
Telegram userbot in python
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?
<...
5
votes
2
answers
453
views
Weakly-Referencing Tree Structure in Python
For another project of mine, I decided that it would be handy to have a tree structure to dictate hierarchy between pieces of data, but I didn't want to unnecessarily keep that data alive if it would ...
8
votes
2
answers
1k
views
Python OOP game of Hangman
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. ...
4
votes
2
answers
283
views
Reading a webpage for its list of sites, but getting only the sites I want
Currently, I have this "leave only the urls that don't have unwanted substrings inside" code. I originally tried to use a comprehension to filter the unwanted urls.
...
8
votes
3
answers
469
views
Interpolating based on non-diagonal neighboring values
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 ...
6
votes
2
answers
311
views
Visualize Python data in JavaFX with Py4J
For a larger project, I need to build a bridge between a Python and a Java programme. I decided to use Py4J and constructed a smaller problem to familiarise myself with the first steps.
Java is ...
5
votes
3
answers
1k
views
Project Euler Problem #1: Multiples of 3 or 5
Project Euler Problem #1
Multiples of 3 or 5 states:
If we list all the natural numbers below 10 that are multiples of 3 or
5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of ...
4
votes
4
answers
141
views
Alerts by phone calls for location-relevant Israel Home Front Command alerts
This code checks the Israeli Home Front Command API, and when there is a new alert for specific areas it sends a request to a Django app which I am hosting in the cloud. The Django app then sends a ...
3
votes
0
answers
111
views
Predictive Maintenance ML Project on Jupyter Notebook
I have built a predictive maintenance machine learning project in a Jupyter Notebook, with plans to convert it into a Flask application later on. The code is functional and passes Ruff tests. But I am ...
0
votes
1
answer
103
views
Staff Rostering Problem - Minimize max night-shift
I'm doing some mini projects for my club related to fundamental optimization and am having a bit of trouble with this issue.
There are N employees numbered 1, 2, ..., N who need to be scheduled for ...
3
votes
1
answer
90
views
Follow up - Deep Learning Project for House Plant Identification on Kaggle Notebook
The code is based on feedback that I received from my previous question regarding this project.
I've developed the initial code for a deep learning project focused on identifying house plants within a ...
4
votes
2
answers
83
views
Kaggle Notebook for Identifying House Plants
I'm working on a personal deep learning project on identifying house plants. I have developed the initial code in Kaggle Notebook. I'll later transform it into a Flask app.
I have just finished the ...
7
votes
2
answers
327
views
Iterative Deepening A* implementation of 15 Puzzle solver in Python
Introduction
I recently finished the course Mathematical Thinking in Computer Science on Coursera. The sixth module is optional and involves learning about transpositions, permutations, and applying ...
10
votes
6
answers
1k
views
Extract unique email addresses from a text file
I'm working on a Python script that reads a text file and extracts all the unique email addresses. The code works as intended, it produces the correct output, throws no errors, and I've tested it on ...
6
votes
2
answers
111
views
Slack User Interaction Graph – Collaboration Topology
I’ve written a small Python module to generate mock Slack workspace data, build a user–user interaction graph, and surface complementary collaborators based on skill sets.
The key features are:
Data ...
1
vote
1
answer
56
views
Predictive Maintenance ML Project in Jupyter Notebook
I am developing a predictive maintenance project using Machine Learning. I have completed the initial code in Jupyter Notebook. Later, I will convert it into a Flask app.
The code is working fine for ...
2
votes
1
answer
59
views
Flask App for Weather Prediction Using Machine Learning
I am building a personal machine learning project to predict the weather. I have already completed the code in Jupyter Notebook. Now, I am working on converting it into a Flask app.
I have just ...
5
votes
4
answers
692
views
Functions to check if a number is a multiple of another, get all the even numbers in a list, and all the odd numbers in a list
I wrote some basic math functions:
...
5
votes
3
answers
461
views
Functions to check if object matches type and reverse a string
In what case would anyone find these useful?
...
5
votes
1
answer
146
views
Flask App: ML Project on Predicting Weather
I am working on a basic, personal ML project on predicting weather. First, I have finished working on Jupyter Notebook. And now, I am transforming it into create a Flask app.
I have just completed the ...
1
vote
1
answer
55
views
ML Project: Predictive Maintenance in Jupyter Notebook
I'm working on a predictive maintenance ML project and have developed the initial code in Jupyter Notebook. I'll later integrate it into a Flask app.
The code currently functions without any issue, ...
5
votes
2
answers
94
views
Simple Word-Based Text Truncator
I created a Python 3.11 utility that truncates an input string to a fixed word count—splitting on any whitespace, collapsing runs, and dropping trailing stop-words—so you get clean, concise snippets ...
2
votes
3
answers
114
views
Splitting input text into fixed-size overlapping word chunks
I’ve implemented a small utility function in Python 3.11 that takes an input string, splits it into word-based chunks of a given size, and allows a specified overlap between consecutive chunks. This ...
2
votes
1
answer
127
views
ABC/XYZ business process analysis
I have written a code that deals with ABC/XYZ analysis. I want to use it in my application and would like to find out how the code can be improved, its readability and it will be better to implement ...
5
votes
2
answers
92
views
Calculate distance score for local alignments (ex. Gotoh local)
Is there a better way to calculate distance scores for local alignment than this? Or is the method that I'm currently using robust enough? The full code is here with the actual alignment ...
12
votes
4
answers
1k
views
Simple mutation simulation for use in science class
I've been giving my grade tens an introduction to computational phylogenomics, based around computing dissimilarity between DNA strands, and a simplified model of mutation. They've been exploring how ...
3
votes
1
answer
84
views
ML Project on Predictive Maintenance of Machines
I am working on a personal machine-learning (ML) project on predicting maintenance of machines. First, I am working on Jupyter Notebook. Then I will create a Flask app.
I have just completed the code ...
7
votes
3
answers
557
views
Team picker command line application
I've made a program for randomly splitting game participants into different teams. The code works and solves the problem. I'm interested in advice on what you'd do differently or better.
...
1
vote
0
answers
124
views
Jupyter Notebook - ML Project on Weather Prediction
I am working on a personal Machine-Learning (ML) project to predict weather on Jupyter Notebook. Once I am done with it, I will start working on converting it into a Flask app.
I have completed my ...
3
votes
1
answer
169
views
Synchronize clock tick for timed action
The code shown below goes back to the tutorial How to Use a Timer in Tkinter.
I first simplified the tkinter import by restriction to Python 3.
Then I found a ...
2
votes
1
answer
136
views
ML Project on Jupyter Notebook - Weather Prediction
I am working on a personal Machine-Learning (ML) project to predict weather. Right now, I am working on Jupyter Notebook. Once I am done with it, I will start working on converting it into a Flask app....
4
votes
2
answers
723
views
ML Project - Weather Prediction on Jupyter Notebook
I am working on a personal Machine-Learning (ML) project to predict weather. Right now, I am working on Jupyter Notebook. Eventually, I will transform it into a Flask app.
I have completed my code on ...
4
votes
1
answer
371
views
ML Project on Predicting Weather App
I am working on a basic, personal ML project on predicting weather. First, I am working on Jupyter Notebook. Then I will create a Flask app.
I have just completed the code on Jupyter Notebook. Would ...
7
votes
2
answers
538
views
Subtracting the sum of the current digits from a positive integer N until it reaches 0
Given a positive integer N, subtract the sum of its digits and count how many times this operation must be applied to make N become 0.
...
2
votes
2
answers
468
views
Leaderboard ranking system in Python
I'm working on an assignment where I have to implement a leaderboard system using only Python's standard libraries (no external packages allowed). However, my current code keeps getting TLE (Time ...
6
votes
1
answer
571
views
Testing a user submitted python function
I am creating a website with coding questions. When a user submits a code for a question I use the contents of the question to create a python file and then I send it to the piston API for evaluation.
...