Questions tagged [python-3.x]

Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008. Use this tag along with the main python tag to denote programs that are meant to be run on a Python 3 interpreter only. Do not mix this tag with the python-2.x tag.

Filter by
Sorted by
Tagged with
2 votes
1 answer
28 views

Convert sorted list to BST

I am working on a Daily Coding Challenge to convert a sorted singly-linked list into a binary search tree. We are given the head of the list; the definitions of ...
Arya Singh's user avatar
1 vote
0 answers
51 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 ...
Robert3737's user avatar
0 votes
1 answer
66 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 ...
Klaus3's user avatar
  • 123
3 votes
1 answer
101 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 ...
razzleDazzle's user avatar
4 votes
4 answers
571 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 ...
mankand007's user avatar
1 vote
2 answers
134 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 ...
Linny's user avatar
  • 9,948
0 votes
0 answers
53 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 ...
hexapod's user avatar
2 votes
0 answers
86 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 ...
my_stack_exchange_account's user avatar
3 votes
1 answer
520 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 ...
kiaora's user avatar
  • 31
2 votes
1 answer
38 views

Python Module for representation, calculus and rich comparisons between temperature scale instances

ToTemp is a temperature conversion package with Celsius, Delisle, Fahrenheit, Kelvin, Rankine, Réaumur, Newton and Rømer scales. With a documentation and already in PyPI. The source code for the main ...
eddyxide's user avatar
  • 141
0 votes
0 answers
35 views

Flask App - create the admin account (Suggestios or Improvements)

I know this may be a silly question..., but I'm trying to create a function in python that allows me to register an account for the admin user. If the administrator does not specify any data, be it ...
jr.çhåvez__07's user avatar
1 vote
0 answers
370 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 ...
mon's user avatar
  • 111
2 votes
1 answer
96 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 ...
Tee Mothy's user avatar
2 votes
1 answer
71 views

"Tic-Tac-Toe" implemented in Python

With the following code I implemented the mini-game "Tic-Tac-Toe" in Python. However, I am still a beginner in programming and I wanted to ask if someone could give me some tips on how to ...
py_programmer_47845's user avatar
6 votes
2 answers
916 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 ...
Gavin Greenhorn's user avatar
0 votes
0 answers
72 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 ...
Revolucion for Monica's user avatar
3 votes
2 answers
111 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-...
ashton's user avatar
  • 133
2 votes
3 answers
102 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: ...
angel's user avatar
  • 35
0 votes
1 answer
313 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 ...
Life is complex's user avatar
1 vote
1 answer
95 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 ...
angel's user avatar
  • 35
4 votes
0 answers
164 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),...
retep's user avatar
  • 169
1 vote
0 answers
28 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 ...
Guy's user avatar
  • 53
3 votes
1 answer
84 views

Tap-Type-Game in Python (fast-typer)

Hello everyone Last week I've started creating a little project for fun - TapType Game, I know there is a lot of things to make better, but what about my solution, can you give me some general tips, ...
KermitTheFrog's user avatar
1 vote
1 answer
197 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 ...
Karn Kumar's user avatar
3 votes
1 answer
123 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 ...
Ruan's user avatar
  • 101
4 votes
2 answers
183 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 ...
Blinding Slow's user avatar
3 votes
2 answers
118 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,...
Looser User's user avatar
8 votes
3 answers
129 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,...
Looser User's user avatar
1 vote
0 answers
54 views

Save Game Editor in Python/PySide

I'm developing a Xenoblade Chronicles 3 save data editor in Python with PySide6. My experience in Python has, over the years, been terminal scripts or web applications, so GUI scripting is completely ...
Xeuxs's user avatar
  • 23
0 votes
0 answers
77 views

How to efficiently store and compute forecasting curves?

Let PD be a Plane/Date couple. For each PD, I would like to predict the forecasted booking curve, i.e. the cumuled amount of bookings registered each day between X days before departure and departure. ...
Doe Jowns's user avatar
0 votes
0 answers
23 views

Automated back up of feature layers in ArcGIS Online - How could this code be condensed?

I currently work as a GIS Coordinator for a small scale utility that uses AGOL. That being said, many of our feature layers are hosted in AGOL and are regularly edited or modified in the AGOL ...
Austin Averill's user avatar
0 votes
1 answer
64 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 ...
Tee Wen Hao's user avatar
0 votes
1 answer
3k 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 ...
Tariq A's user avatar
6 votes
2 answers
258 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 ...
Piovezan's user avatar
  • 257
1 vote
1 answer
46 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 ...
Alex Ramirez's user avatar
4 votes
1 answer
272 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 ...
HoneyBadger's user avatar
4 votes
2 answers
130 views

Sort todo.txt items by due date in Python 3

I am using the following format for my task management: https://github.com/todotxt/todo.txt Do some stuff +uni due:2022-12-31 Write some paper +uni due:2023-01-10 ...
Tomas's user avatar
  • 43
9 votes
2 answers
189 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 ...
RandomCoder59's user avatar
8 votes
2 answers
985 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 ...
RandomCoder59's user avatar
0 votes
0 answers
37 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 ...
tung's user avatar
  • 97
2 votes
1 answer
341 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 ...
tung's user avatar
  • 97
0 votes
2 answers
278 views

Binary Search written in python with O(n) [closed]

def search(nums, target): for i in range(len(nums)): if nums[i] == target: return i if nums[i] == None: return -1 I think ...
111's user avatar
  • 45
0 votes
1 answer
61 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 ...
Qohelet's user avatar
  • 151
1 vote
1 answer
158 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 ...
LeoninJesterXII's user avatar
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
3 votes
3 answers
250 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 ...
n0k's user avatar
  • 31
0 votes
1 answer
175 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 - ...
Nikita Aleksandrov's user avatar
1 vote
0 answers
155 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 ...
Maxime's user avatar
  • 111
1 vote
1 answer
151 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 ...
AstralSystem7's user avatar
0 votes
0 answers
97 views

How to optimise this cosine similarity loop and function in Python?

I need to find cosine similarities between two lists of different sizes. I have this code but it is running for a long time. The first list has 40 000 words and the second list has 400 words. Is it ...
David's user avatar
  • 1