All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

solve sudoku board from the given file and check it python

I'm stuck with sudoku board. The condition of the problem requires opening the file that stores the sample sudoku board, editing it, and after closing it, check whether the problem is solved correctly,...
  • 1
-1 votes
1 answer
42 views

Graph function in console

I created a program for drawing graphs of functions and want to hear ideas on "how to improve this program", because I'm only starting to write programs in Python. Would be very good to hear ...
-1 votes
0 answers
33 views

Decorate functions such that the outer function flattens all its input arguments before passing those input arguments into the inner function [closed]

The code to review mostly at the bottom-end of this question. Use cases are located at the top-end of this question. Use Case One ...
1 vote
0 answers
25 views

Search Stack Overflow and GitHub for code in a specified language

This code is designed to scrape Stack Overflow and GitHub, pulling information based on a user-specified programming language and processing the data into a format for AI learning. It uses a number of ...
0 votes
1 answer
62 views

Optimize system of equation function organizer with memory bottleneck in python

The Code So i have the following function that just gathers a system of equations so it can be input into the standard solvers of scipy ...
  • 113
3 votes
1 answer
53 views

A simple web scraper for nature.com news articles

I have created a simple web scraper that fetches news article previews from nature.com and saves each article to a file containing the article preview text. I am learning independently, so I would ...
3 votes
4 answers
527 views

Built a function to search a dictionary using key or value

I'm building an error handler which handles different kinds of errors arranged hierarchically. As part of that, I need a way to figure out what errors to send a recipient based on what their ...
0 votes
0 answers
41 views

Python script that parses GOG .hashdb files

I have some .hashdb files with names like goggame\-\d{10}\.hashdb in the installation folders in some of the games I have, and I want to extract information from ...
0 votes
2 answers
77 views

Find the shortest distance between two letters

I've been tasked with finding the distance between two letters in the alphabet. Below is my solution. My main concerns are if there is any shorter way to do this, and if there are any edge cases I'm ...
  • 9,719
0 votes
0 answers
45 views

Choose and locate a word in PDF

This code searches helps to choose a word and locate the word in a PDF, by highlighting it, and drawing a box around it. I found problem with the border of the rectangle, as it's thickness cannot be ...
2 votes
0 answers
53 views

Snake game with constant time complexity algorithm

https://github.com/speedrun-program/constant_time_snake_game Memory efficient snake game with O(1) algorithm for snake movement and bug placement. Three grids are used: a grid representing the game ...
3 votes
1 answer
88 views

Calculate overlap of two datetime objects

I would like to find out how much time lays in between 22.00 and 6.00 o’clock for a given event per day. So if the event start at 21.00 and ends at 23.59 the result would be 1.59. For a start at 22.00 ...
  • 31
1 vote
0 answers
32 views

Object detection YOLO v1 loss function implementation with Python 3 and TensorFlow 2.x

About the code Object detection YOLO v1 loss function implementation with Python + TensorFlow 2.x. It based on the Pytorch implementations below and re-implemented with TensorFlow based on my ...
  • 111
2 votes
1 answer
70 views

Update an Excel master workbook with values from new workbook

I have a master .xlsx file on which other spreadsheets depend. Each week, I export a new .xlsx file (from MRP) that may or may not be the same as the master. The columns are always identical. Rows may ...
6 votes
2 answers
878 views

Python script to get and save data from a web API

I'm working as a system administrator (sort of), but learning Python on the side. Life gave me a chance to apply that knowledge, since our organization is being provided cloud email service, and it ...
0 votes
0 answers
43 views

Walk a folder of files and extract creation date, countries mentioned and a summary based on their text for each

I made a script that scans a folder of 723 documents (pdf, pptx, docx) to extract the 'Name', 'Type', 'NbPages', 'Creation Date', 'Period Date', 'Countries', 'Summary', 'Indicateurs', 'Path'. I think ...
3 votes
2 answers
92 views

Custom-made spellchecker with Wiktionary

I have been coding on Python for two weeks. All I want the code to do is this: Check if each word in sentence has an English category Wiktionary article Ignore all words inside quotations and proper-...
  • 133
2 votes
3 answers
91 views

Wordlist formatter code

I am making a "wordlist cleaner" module that loads a words.txt file, and returns a list of cleaned/sorted words. Full code: ...
  • 35
0 votes
1 answer
140 views

Type hints and expected types

I'm unsure if this question belongs on Code Review or Stack Overflow. Another developer told me that I should consider adding type hints to my open source project WordHoard. I have never used type ...
1 vote
1 answer
72 views

Excluding attributes entirely vs. setting them to None

I am making a program that parses profiles from a website. Some profiles are "public" and others are "private" with limited information. Public profiles contain a lot more data and ...
  • 35
4 votes
0 answers
151 views

constraint solving graduation using HTML Parsing, pandas, and z3

not sure if this project fits on code review, but my code is getting extremely messy, and would love some tips to clean it up! Overview The project is designed to take in an HTML file (a degree audit),...
  • 169
1 vote
0 answers
26 views

Improving the readability, extensability, and optimization of a custom ETL Pipeline library (Pypeline.py)

I'm looking to improve the logic used in this ETL pipeline manager. The concept creates a structure: Pipeline(Pipe(Task, [Task, ...]), [Pipe(...), ...]) ...where a ...
  • 63
1 vote
1 answer
55 views

Python boto3 code to get the matrics from aws cloudwatch

I am working on a boto3 library and getting some metrics from aws cloud service cloud watch and that works perfectly fine, however, I am placing this question just ...
3 votes
1 answer
104 views

Solve an option pricing PDE in Python - Part 1 [closed]

The Github repository NM-Heston solves call option prices under the Heston 2-factor model using ADI splitting schemes. I am adapting the code to price options under the 3-factor Heston-Hull-White ...
  • 121
4 votes
2 answers
152 views

Simple implementation of Rock, Paper, Scissors game in Python

This is my first attempt at writing code from scratch. I'm visually impaired and would like to know if the code is well structured, commented and readable for a collaborator who might read it in the ...
3 votes
2 answers
105 views

Sort a dict by keys, assuming keys are orderable

I found a suspicious code snipped in an existing project in which I am involved as a developer. The code sorts a dict by its keys, so that if iterated over the dict,...
8 votes
3 answers
119 views

Compressed output of set in Python

In order to provide a better output of sets with many consecutive elements (a similar class could be written for a list or tuple,...
0 votes
1 answer
51 views

Automate the Boring Stuff with Python 2nd Edition - Chapter 8 - Sandwich Maker Project [closed]

I am learning Python through Automate the Boring Stuff. And I was trying to do the practice project Sandwich Maker in Chapter 8, although I somehow already solved the problem but I encountered some ...
0 votes
1 answer
291 views

A program that calculates hourly wage / overtime

Question Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked ...
6 votes
2 answers
246 views

A selection sort implemented in Python

I'm not proficient at Python. My question is twofold: whether this selection sort algorithm implementation for number lists could be considered clean code (in the sense of being modular and ...
  • 257
1 vote
1 answer
42 views

Is this a correct way of doing ECS?

I'm trying to use ECS with Pygame and was wondering if I'm doing this right before I go any deeper than this. I've tried learning more about ECS but it's mostly in another language, which I could ...
5 votes
1 answer
259 views

Slot Machine Project

I am familiar with Python but recently I have been trying to solidify my skills as a Python developer. I decided to do a project that would help me build some skills using the fundamentals of the ...
5 votes
0 answers
37 views

iChemistry - Learn chemistry with python

I decided to build a quiz type of game for improving chemistry linguistics using python. Currently there is not much variety in terms of questions, but before expanding the question base, I would like ...
8 votes
2 answers
230 views

Text based chess game in Python

I have reached a significant milestone since the start of my chess game project. I have implemented all basic functionality. There is no castling, en passant and pawn promotion yet but I have ...
0 votes
0 answers
29 views

Synchronized insertion to InlfuxDb using Python

I am connecting to various topics of the exchange websocket to fetch the data into the callback function, where it will insert to the InfluxDb, however, I am afriad the way I do below has low ...
  • 77
2 votes
1 answer
253 views

How to structure in handling websocket and inserting data to databse in Python

I connected to the websocket, and the data response in the callback function handle_message. I wish to insert all the data to influxdb using ...
  • 77
0 votes
1 answer
54 views

Checking several strings against a n-depth list of lists and returning one if its values

The data structure I am working with is a list of lists that is created by parsing a file. The depth of the list can vary. The list can have n Strings before its child-value begins. My current example ...
  • 161
1 vote
1 answer
90 views

Simple text-game navigation system

I am a total newbie when it comes to coding in general, let alone Python. After following a few tutorials, I decided to try making my own little navigation system for simple maps, sort of drawing from ...
1 vote
0 answers
25 views

Optimizing search algorithm for guessing list of strings via function returning bool if substring is in list [duplicate]

I trying to figure out the most effective way to accomplish this task: A function, check(), contains a list of strings. Calling the function with a string as ...
user avatar
2 votes
3 answers
144 views

Most effective search algorithm for guessing list of strings via function returning bool if substring is in list using Python

I trying to figure out the most effective way to accomplish this task: A function, check(), contains a list of strings. Calling the function with a string as ...
  • 21
0 votes
1 answer
77 views

Translating excel spreadsheets

Context: This is a program that translates spreadsheets to English from Dutch using another custom library (transl). Question: Would like to hear criticism or advice on how to make the code better - ...
1 vote
0 answers
62 views

write a wrapper for cosmos db calls to use the results as objects in python (technically an ORM)

As part of a larger program, I'm trying to find the cleanest way to architecture my program to query a cosmos db and use its return values (dict objects) as easy to manipulate and maintain objects in ...
  • 111
1 vote
1 answer
44 views

Robot battle game Terminal game code

This is a project for a class and all the requirements are met, I just wanted to do a little more and make this even better. All the changes that I've made are already implemented and I would like to ...
2 votes
0 answers
53 views

Get priority of trucks (Advent of Code 2022: Day 3)

...
  • 505
1 vote
1 answer
42 views

Further optimizing the ISING model

I've implemented the 2D ISING model in Python, using NumPy and Numba's JIT: ...
0 votes
1 answer
200 views

Calculate score of rock-paper-scissors (Advent of Code 2022: Day 2)

Advent of code, Day 2. Here is my code. Less verbose version of the question follows. ...
  • 505
-1 votes
2 answers
95 views

Looping through asset types from Dictionary [closed]

I have some code that needs to branch depending on if a value from a database is absent. Essentially our database contains some key value pairs from a dictionary. If the key is absent from a set, we ...
1 vote
1 answer
90 views

Numpy segmented Sieve Of Eratosthenes

For the segmented Sieve Of Eratosthenes, I have devised the following code provided. And I understand that it is not the best implementation; However, it should be much quicker than what it is now. ...
1 vote
1 answer
135 views

Find primes using Wilson's Theorem

The following code is an instantiation of wilson's theorem. It uses a simple factorial and division theorem to check for primality. My issue is with the performance of the code, and there are two most ...
3 votes
2 answers
882 views

Convert Rankine temperatures to Celsius

I have this Python Package called ToTemp under development for precise Temperature Conversions and currently thinking in changing the method's implementation to be ...
  • 139

1
2 3 4 5
102