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
521 views

The smallest positive number that is evenly divisible by all of the numbers from 1 to 20

Problem description: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of ...
user avatar
3 votes
3 answers
124 views

The largest palindrome made from the product of two 3-digit numbers

Problem description: A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the ...
user avatar
5 votes
2 answers
106 views

Playing a game of ConHex in Python

Background ConHex is game by Michail Antonow where two players try to create a connected chain of cells from one side of the board to the other side. They do this by claiming one empty position each ...
user avatar
  • 343
0 votes
0 answers
33 views

Python function that skews an image while preserving its aspect ratio using affine transformation

See this post for more details. I re-implemented my idea using affine transformations, and finally understood how transformation matrices are formed... Turns out it is stupidly simple, but nothing I ...
user avatar
3 votes
1 answer
109 views

Python function that shears image by n degrees while keeping the relationship between height and width

I am trying to find a method to shear/skew an image horizontally or vertically by n degrees (n ranges from -90 to 90 excluding the terminals) so that the result would meet the following conditions: ...
user avatar
3 votes
2 answers
76 views

Generate readable English words from given letters

I was redirected from StackOverflow to your community in hope to get some help and improve my script. The script receives letters as input and generates possible words, then extracts readable words ...
user avatar
  • 33
3 votes
1 answer
185 views

Python script to POST requests to a networking device

Request to review my code please and see if I am following the best practices. This is sending a POST operation via a Python script using the requests library to a networking cloud orchestration ...
user avatar
2 votes
1 answer
45 views

Python CLI math game

I'm a self-taught programmer starting out with Python and my latest project is this game: It runs in the console, displays an equation, takes the user's answer, and increases your score if it's ...
user avatar
  • 23
5 votes
1 answer
209 views

Formatting a table using unicode symbols in python

The goal of the project is to take in input for a data, perhaps in the future as a csv, then print it out using UNICODE box-drawing characters. The main function ...
user avatar
  • 151
2 votes
1 answer
47 views

Coin partitions

I am looking to obtain the partitions of coins that sum to a target amount So I tried search online, but every single website loves to use this problem to show the benefits of dynamic programming. ...
user avatar
2 votes
0 answers
36 views

simple OOP Blackjack

It has been a long time since I have gotten into OOP with python. I made this short little program. Are there any ways that I can make it more clear or concise (pythonic if you may)? ...
user avatar
  • 121
1 vote
1 answer
89 views

Printing a JSON/HTTP response from a Cisco endpoint

Please check over my Python code for a HTTP GET operation using the requests library, and provide any potential pointers for improvement. ...
user avatar
2 votes
0 answers
29 views

Minesweeper program using Tkinter

I have complete my minesweeper game using Tkinter and would like to know ways to improve. I also have a question for extra features: does anybody know a way to have a opening start, like google ...
user avatar
  • 147
1 vote
0 answers
41 views

Timer with input, sound and flashing ( Just timer :) )

I know that this program is not very outstanding, but I'm learning "Python" and decided to publish this code in order to get some advice and parting words and overall evaluation of the ...
user avatar
  • 41
7 votes
1 answer
640 views

Wordle guesser, breaking out of loop by raising exception

After many years away from writing in Python, I am getting back into it. Specifically, I am trying to teach myself dataclasses. As an exercise I wrote a Wordle-solving program. I downloaded the ...
user avatar
3 votes
1 answer
392 views

Can two knights pieces attack one another from current positions?

I am working on my Python skills and would like some feedback on this problem I have tried to solve. I would like to return a boolean if two knights at their current position can attack each other ...
user avatar
3 votes
1 answer
177 views

Automate the Boring Stuff CH 10 - filling in the gaps

This exercise comes from Automate the Boring Stuff CH 10 - second edition. The exercise is called "filling in the gaps," and the instructions are as follows: Write a program that finds all ...
user avatar
  • 117
9 votes
3 answers
1k views

A Simple Tic-Tac-Toe Game

I wrote a simple tic-tac-toe game in Python. I'm pretty much a novice, but I do have some experience with coding other things in Python. I just wanted to see if I was capable of writing a simple tic-...
user avatar
  • 143
1 vote
0 answers
25 views

TCP socket management using multiprocessing

I wrote a Python code for a device that generates an hotspot and communicates with an app using a TCP socket. The communication is managed by a process that opens a socket and uses two threads to send ...
user avatar
  • 111
3 votes
2 answers
65 views

Pascal's triangle solution in Python code

I have solved the pascal's triangle problem. I am not good at writing efficient programs, hence any suggestions/ comments shall be welcomed. ...
user avatar
1 vote
2 answers
67 views

Generating random integers in one of three ranges

I have a function returns a random integer number. This function only accepts these three numbers 1,2 and 3(there's another function in my code which is make sure of this otherwise that function will ...
user avatar
  • 13
4 votes
1 answer
73 views

Weird things to do to an image

Here is a program I wrote to take an image and do weird things to it. Is there any more weird things I can add? Right now I have: Chop the image Flip the image (up/down and left/right) Rotate the ...
user avatar
1 vote
0 answers
50 views

PyQt6 Wordle game... with some filtering according to the current state

Refer to Wikipedia English for more context on Wordle. This version behaves exactly like the standard Wordle game, except that it displays all possible choices in the current condition on the left ...
user avatar
5 votes
3 answers
788 views

Class to calculate values of equation ρ = m / v

Function: This is to calculate the values for the equation: $$\rho = \frac{m}{v} = \frac{mass}{volume}$$ what I need help with: I still can’t get my head around classes and want to know if I’m doing ...
user avatar
  • 191
2 votes
0 answers
62 views

A simple Python script that crawls information about Youtube playlists and your watch history

You will need to follow this guide. This is a Youtube crawler that crawls information about Youtube playlists, it uses Youtube Data API v3 and it crawls the title, url, description, count and videos ...
user avatar
1 vote
0 answers
92 views

Asynchronous socket server implementation from raw sockets

I've rewritten my HTTP server several times over the past year, because I tend to encounter an issue midway through an implementation realizing I didn't abstract, decompose, or decouple certain ...
user avatar
2 votes
2 answers
81 views

Regex and pandas to read forecast sky condition string

DataFrame methods to parse the sky condition from a terminal aerodrome forecast. A line in a taf can report zero-eight cloud layers. Cloud layers are required in predominate lines, and optional in ...
user avatar
3 votes
0 answers
37 views

Replace badly formatted questionnaires in a document using regex

I have rather badly formatted questionnaires (i.e. ordered lists) in a bunch of documents that I want to clean up and replace the current version with the cleaned-up version. Example text ...
user avatar
  • 131
0 votes
0 answers
63 views

Python 3 OpenCV script that scans a giant picture to make a video

This is a Python script that I wrote completely by myself. Basically it scans a giant picture to make a video. They say one picture is worth more than a thousand words. Since a video contains ...
user avatar
2 votes
1 answer
54 views

Regex pattern matching to generate pandas multi index

Mostly just looking for a review of my regex and implementation of capture groups. its something I've been working to improve. The indexes have somewhat of a pattern to them of being.... ...
user avatar
6 votes
2 answers
419 views

Word Analyzer: Counts total characters, names starting and ending letter, determines if my initials are present in the word

I wasn't sure where to post this, but I'm just looking for a brutally honest critique of a program that I built. I'm new to coding and am taking my first course on it. I'm just trying to determine if ...
user avatar
2 votes
1 answer
63 views

PyQt6 program that helps you categorizing items

Interface: Console output: ...
user avatar
4 votes
2 answers
78 views

Read a file format with mixed CSV and non-CSV content

I have a file format that I need to read which contains blocks of CSV data interspersed by non-CSV (or at least, inconsistent CSV) lines. Other than the very first line of the file (which has comma-...
user avatar
  • 263
1 vote
0 answers
45 views

PyQt6 program that lets you adjust the HSV values of an RGB color

I don't know how to actually describe what this script does concisely. I am writing GUI programs using PyQt6, and I want the most beautiful palette for my programs, so I browsed Wikipedia for a bunch ...
user avatar
0 votes
0 answers
72 views

Constructing a dependency list recursively

I am trying to find if there is better way to do this recursion. I went through some examples of memoization but found myself struggling to implement that with my code. example data: db_data and ...
user avatar
  • 1
6 votes
1 answer
129 views

Binary search algorithm (Python 3.9)

New to using this platform and would like to familiarise myself with it so would just like to ask if I am exhibiting good practice with my programming. Started the online CS50 course today and thought ...
user avatar
5 votes
2 answers
722 views

Find non-overlapping pairs of elements in a list whose difference is less than some given threshold

I have the following task: Let us have a list (denoted by L, and for simplicity, the elements come from the interval [0,1]). We are given a parameter (denoted by C), and we want to find as many pairs ...
user avatar
  • 153
6 votes
3 answers
691 views

Python analog clock with turtle - runs slow

I made a python analog clock program with turtle. The problem is, it takes about 1.4 seconds to loop, so it only moves the second hand every 1.4 seconds. Its probably cuz my computer is slow... ...
user avatar
2 votes
2 answers
62 views

Basic command-line Python calculator

I made this basic Python calculator. It just does addition, subtraction, division, and multlipication. I feel like the code is a mess, but it does what I want it to, and I feel like it does it ...
user avatar
5 votes
1 answer
424 views

Breaking Bad name generator

I've created a script to print all periodic table symbolic permutations of a string. As seen in the opening credits of each episode of Breaking Bad: © 2010-2022 AMC Networks Entertainment LLC. ...
user avatar
2 votes
1 answer
88 views

Python script to convert scripts to png files

I have written a Python script that converts scripts to png files, entirely by myself without anybody's help. A picture is worth more than a thousand words so I will let the picture do the ...
user avatar
0 votes
1 answer
59 views

Stacking Z axis on multiple [1440x720] DataFrames (X, Y)

Each datum represents a point in a 1440x720 image of the globe, The values are 0-9. Each new layer is of a higher elevation. I need to structure a DataFrame in a ...
user avatar
5 votes
0 answers
108 views

Python 3 script to make photo collages

I have written a Python script that takes a list of filenames of pictures and generates a photo collage of them. This is my most complex project yet, and I have written it completely by myself (like I ...
user avatar
0 votes
0 answers
50 views

mypy type hinting with an extended pandas Series

I'm learning to use mypy and the pyproject.toml config pyproject.toml ...
user avatar
3 votes
1 answer
83 views

Python 3 number convertor that converts floats between decimal and bases 2-36

This is a Python 3 script that converts any real number (ints and floats) from decimal notation to any positional number system ...
user avatar
0 votes
1 answer
83 views

Class that handles 'user' info

So I started learning how to code about 6 days ago and suddenly realized that I've really only been referencing my book and myself without any outside input. I'm learning python and the most complex ...
user avatar
1 vote
1 answer
89 views

Find next biggest palindrome

I have written a program for the SPOJ PALIN problem: A positive integer is called a palindrome if its[decimal representation is the same]from left to right and from right to left. For a given ...
user avatar
  • 41
0 votes
0 answers
42 views

Python one-line binary search

...
user avatar
5 votes
2 answers
191 views

Count five-digit octal numbers with alternating even and odd digits, without repeated digits

I need to find the number of five-digit octal numbers in which all digits are different and no two odd or even digits are adjacent. My code below gives the correct answer, but I'm not satisfied. Can ...
user avatar
  • 53
3 votes
1 answer
114 views

The shortest path between airports

Airlines need to provide their customers with flights to every corner, so they need an app that allows them to do so. The customer must be able to transfer when there is no direct connection. The ...
user avatar