Skip to main content

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
0 votes
0 answers
5 views

Quiz interface based on Yaml files Python

I am training for a Symfony certificate. I found a Github repository providing questions to prepare for the exam. The repository contains a data directory with a bunch of questions mapped by topic in ...
O'Niel's user avatar
  • 227
3 votes
1 answer
68 views

Polynomial parsing using regular expressions in Python

I've made a code in Python 3 which converts a polynomial with integer coefficients (in simplified integer form) from string form to a list of tuples of the form (coefficient, exponent, variable). It ...
Sam's user avatar
  • 145
7 votes
1 answer
346 views

Phonebook (working with vCard file)

Project dependencies: vobject prettytable python-dotenv Environment variable (.env): ...
ykoavlil's user avatar
  • 143
5 votes
2 answers
634 views

Readability and error handling improvements for Python web scraping class

Description I recently wrote a Python script to download files from the Library of Congress (LOC) based on a search query. The code fetches metadata, extracts file ...
IntegerEuler's user avatar
2 votes
2 answers
233 views

Infinite 2d block world (2d minecraft) with chunk system, physics and slower loading

Follow up from this question. I have added a slower loading system that allows the main game to run faster but I still get under 30 fps with caves even if I allow the player to outrun the loading. I ...
coder's user avatar
  • 121
4 votes
1 answer
109 views

Calculate optimal game upgrades, v2

This is the second iteration of the code I originally posted here: Calculate optimal game upgrades. Based on the feedback there, I chose to change the code to use a dynamic programming approach with ...
ayaan098's user avatar
5 votes
2 answers
107 views

JiraWatcher - A script that helps track the progress of testing versions

There are several versions that can include subversions. The description field contains a Git log of changes, for example: ...
ykoavlil's user avatar
  • 143
3 votes
1 answer
81 views

Flask App that generates Word Chronology from Word document

I made this simple Flask App, which takes a paragraph-referenced Word .docx document as an input and downloads a Word .docx ...
Jasper's user avatar
  • 33
5 votes
4 answers
2k views

Program for an employee database using python

In this program I'm defining functions to perform different tasks on a data record book for employees. Here is a summary of the code: Intro() to make the presentation of the home page. create_record()...
Abhisikta Ray's user avatar
1 vote
1 answer
69 views

Optimizing domain requests and filtering results with Polars

I need to query a large number of domains stored in a CSV file and save the associated metadata from the responses. My final goal is to generate a CSV file after applying filters to this metadata. The ...
Lo Bellin's user avatar
  • 119
3 votes
4 answers
1k views

Calculate optimal game upgrades

I'm looking for ways to improve the performance of this code. Using numba helps performance, but I'm not sure how to further improve it. Any (relatively) simple ...
ayaan098's user avatar
7 votes
3 answers
818 views

Generate all the free polyominoes who's width and height is no larger than 8

I'm working on a puzzle game and I need all the free polyominoes that can fit into an 8 by 8 grid. My code uses Redelmeier's Alogorithm for enumerating them, checks them for rotations and reflections, ...
timeslidr's user avatar
4 votes
1 answer
265 views

Hashable and ordered enums to describe states of a process

I am wiriting am application which needs to store information about an industrial process where products go through the following, strictly sequential phases: ...
Afelium's user avatar
  • 51
4 votes
3 answers
1k views

Coding exercise to represent an integer as words using python

Context: Convert a non-negative integer num to its English words representation. Example 1: Input: num = 123 Output: "One Hundred Twenty Three" Example 2: Input: num = 12345 Output: "...
Silah's user avatar
  • 111
5 votes
1 answer
180 views

Writing a random password generator

I have spent some time with python. I got an idea of creating a random password generator. It generates passwords consisting of random characters. The user can exclude different types of characters (...
taafuuu__'s user avatar
9 votes
6 answers
673 views

Command-line script that strips out all comments in given source files

Explanation The script is designed to be run from the command-line, and takes any number of positional arguments as paths of "input" files (it also takes some optional arguments to customize ...
I Like Python's user avatar
1 vote
2 answers
133 views

Printing a pattern of input string in X shape

Context: Write a program to print the output for the given input(Example is given in comments of my code). String is of odd length. I would be grateful if anyone could give feedback on my following ...
Silah's user avatar
  • 111
6 votes
2 answers
327 views

Zipping Many Files

My question: I'm wondering if anyone more experienced with using asyncio would consider the way I wrote the code to be reasonably canonical asyncio code. Perhaps I'm using overcomplicated or ...
user1848244's user avatar
2 votes
1 answer
64 views

Handler for YAML file settings values

I am writing a program for calculating rocket engines and for its operation I store all the settings in files with the extension .yaml . To do this, I wrote this code and I want to get feedback and ...
alexandrov's user avatar
7 votes
5 answers
807 views

adding data to a CSV file for it to be read

I'm making a program that lets you enter a name and house that adds it to the CSV file for it to be read and print out "Tre is in house Dragon", etc. The code works; I'm just wondering if ...
Big_Port's user avatar
  • 119
1 vote
1 answer
105 views

Dynamically unpacking Python tuples with structure checking using JIT compilation

This interesting unpacking function allows unpacking a nested tuple into the arguments of a function as its arguments, with structure checking support and only one function call overhead excluding one-...
user1537366's user avatar
10 votes
5 answers
1k views

Guess-the-number game in Python

This is just something I did in my free time. How can I improve my code as a beginner? Is there an alternative to using isalpha() What are other efficient ways to ...
Rollis's user avatar
  • 101
5 votes
2 answers
388 views

Cost sharing application in Python

I am very new to Python (yes, I know it's been around a long time). This is my first working just-for-fun project to see if I could do something in Python. I know the UI layout is rather ugly and ...
Zack E's user avatar
  • 595
14 votes
1 answer
1k views

Typical password generator in Python

Password generators are extremely popular on CodeReview with beginners to both coding in general and Python in particular, for a number of reasons: They're (seemingly) easy to implement They offer an ...
3 votes
2 answers
150 views

Check for key in dictionary without magic value comparison

I'm using pydantic in a project to check file formatting for an object, as well as pylint for linting. Whenever I read a file with an invalid format, I want to raise an exception with a descriptive ...
BobVitorBob's user avatar
7 votes
2 answers
155 views

"Polite" internet connectivity check on separate thread

I wrote this class that checks for internet connectivity on a background thread. Targeting Python 3.10. It has two main design goals: Minimize the time get_state() ...
Jason C's user avatar
  • 451
2 votes
2 answers
144 views

"Element Fusion" game where 2048 meets Chemistry

I've developed "Element Fusion," a PyGame-based game inspired by 2048 but using chemical elements. I'm seeking feedback on: Gameplay mechanics Code structure and efficiency PyGame ...
Amirhossein Rezaei's user avatar
3 votes
3 answers
102 views

Determinant of matrix Python

This is an addition of my previous question Python matrix class. I've added a determinant function using Laplace expansion to my Matrix class. What I am looking for specifically is how 3x3 matrices ...
Linny's user avatar
  • 10.4k
2 votes
1 answer
46 views

Optimal Extraction of Longest Sorted Sequence from Individually Sorted Bucket Arrays Without Repetitions

Consider a bucket array containing sorted and/or empty buckets, and the goal is to extract the longest possible sequence in sorted order, under the following conditions: Only one element in each ...
M.A.'s user avatar
  • 121
1 vote
1 answer
283 views

Rules-engine to be improved/simplified for Efficiency (performance), Extensibility and Maintenance?

This is a simple implementation of a rules engine. I am really hating the very long MATCH/CASE function. I am wondering what kind of Design Patterns could be used there to make this code more ...
user avatar
4 votes
2 answers
664 views

Python script to auto change profiles in MSI Afterburner

I am coming from a stackoverflow question and after I hit a brick wall I tried to find a work around. I only found this working for me and work around the ...
Giannis Tsakas's user avatar
4 votes
3 answers
317 views

Calculation of centrifugal liquid propellant injectors

There is this code in which the calculation of the centrifugal nozzle of a liquid rocket engine is performed. All basic calculations take place in the Injector ...
DYNAMIC AEROSPACE's user avatar
1 vote
1 answer
84 views

Clear the temp folder with Python script

I am addicted to cleaning the %temp% folder, so I went ahead and tried with pyautogui at first by making it click ...
Giannis Tsakas's user avatar
8 votes
1 answer
509 views

Battleship vs. computer with Python

I am still pretty new to Python. After spending time on Code Wars and copying a handful of projects from Al Sweigart's Big Book of Small Python Projects, I wanted to build something completely from ...
Jessica Monnier's user avatar
8 votes
5 answers
1k views

Python matrix class

To prepare for my studies in linear algebra, I've decided to write a simple matrix class. This is the initial program, with functions to find the determinant and decomposition(s) to follow. I wanted ...
Linny's user avatar
  • 10.4k
5 votes
2 answers
183 views

Python script to change monitor refresh rate

I recently overclocked my monitor and I am trying to create a script to just click and do the work for me so whenever I want to change my refresh rate I dont have to open windows settings. I think ...
Giannis Tsakas's user avatar
2 votes
1 answer
225 views

Python using generators with Excelwriter - Performance

I'm looking to understand if my code has an obvious blockage or performance pain point that will cause it to operate slower or use more memory than it should. The current Excelfile i am processing ...
sayth's user avatar
  • 131
3 votes
1 answer
275 views

Transferring dataframe columns into dataframe rows

I have the following data: ...
mahmoud988's user avatar
10 votes
2 answers
1k views

A simple Python class designed to facilitate investment portfolio analysis

Background In an attempt to learn a bit more about investing and economics, I've begun writing a simple historical portfolio analysis tool in Python. The ...
IntegerEuler's user avatar
2 votes
2 answers
139 views

A game where the player guesses the computer's number

I am fairly new to programming, and I recently finished part of one of my projects, a guessing game. The part I completed was the game mode where the player guesses the computer's number. I'm quite ...
ADAM WELLER-FAHY's user avatar
3 votes
5 answers
2k views

How do I speed up this simulation program

This is a program to solve a differential equation numerically using Euler method. As of now, it is very slow, and I need to run 10000 Monte Carlo simulations. The differential equation is called ...
Jonathan Wick's user avatar
1 vote
2 answers
71 views

Using odd prime powers, my heuristic tries to solve instances of Exact 3 Cover in polytime, what can be done to optimize it?

By the way, a heuristic is not the same thing as a proven working algorithm that solves all input instances. It could either be experimental or be used to study intricacies in a problem. The purpose ...
The T's user avatar
  • 451
5 votes
1 answer
210 views

Performance Tuning to enable answer for Project Euler #566 "Cake Icing Puzzle"

Related to this question I am still looking for a solution to Project Euler Problem 566 (see link for a nice simulation also): Adam plays the following game with his birthday cake. He cuts a piece ...
DuesserBaest's user avatar
3 votes
1 answer
118 views

Project Euler #566 "Cake Icing Puzzle" Performance Tuning

I am rather new to python and wanted to use Project Euler to learn more about it. The task can be seen here, so I will skip any description of my own: Project Euler Problem 566 (see Link for a nice ...
DuesserBaest's user avatar
2 votes
1 answer
90 views

"Flattening" a 2D STM image by subtracting an Nth order polynomial without typing out all the terms for each N?

I have some scanning tunneling microscopy (STM) topography images that I need to flatten. I have found that for some data I need a 4th order polynomial, but in other cases a lower order works better. ...
uhoh's user avatar
  • 473
3 votes
3 answers
881 views

Basic python rock papers scissors game (first code)

I'd just appreciate if anyone can suggest some incremental improvements that would help me to think better like a coder. Here is the very basic RPS (rock, paper, scissors). One thing I may next add is ...
Mah Neh's user avatar
  • 79
3 votes
1 answer
165 views

Dial up some obscure stats for the Chutes and Ladders game

Years ago, I wrote some code in Perl for the Chutes and Ladders game. I re-wrote the code here in Python. The code simulates one player in a game to see how many spins of the dial are needed to win ...
toolic's user avatar
  • 6,202
3 votes
1 answer
81 views

Scraping website with Python and Selenium to collect data from dynamic website

Summary: The code scrapes the website and collects the data to store it in CSV. It also downloads selected information that is available for download in PDF format. The details and the entire code are ...
sangharsh's user avatar
  • 279
12 votes
2 answers
2k views

Space shooter game using pygame

I have made a space shooter game in pygame with over 800 lines of code (including blank lines). The aim of the game is to kill all of the ships in the game. You start with a small spaceship and one ...
coder's user avatar
  • 121
1 vote
0 answers
89 views

Django Google Authentication App using OAuthLib and DRF

Context I've been working on a Django-based Google Authentication application, designed to manage OAuth authentication without relying on libraries such as ...
Grajdeanu Alex's user avatar

1
2 3 4 5
108