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

Any tips for a Python beginner on this project? (outputting a variable based on the values of other variables)

Posted this on Stack Overflow and got recommended over here. I have, so far, found no errors in the code but it looks a bit complicated and I would like some feedback. This is my second project in my ...
user avatar
0 votes
0 answers
11 views

Improving runtime / readability with conditional addition of columns to pandas dataframe in Python [closed]

I have this clunky comparison that basically adds columns to a pandas dataframe based on certain conditions. Is there a way to write this for better perfomance? Maybe list comprehension? ...
user avatar
3 votes
1 answer
52 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
2 votes
1 answer
130 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
37 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
197 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
-1 votes
0 answers
22 views

Python to display syllables in a word not counting the number of syllables [closed]

Would like to get the syllables in a given word in python. Not counting the number of syllables ...
user avatar
  • 1
2 votes
0 answers
23 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
28 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
1 vote
1 answer
82 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
0 votes
0 answers
16 views

update dictionary values dynamically and reduce cognitive complexity of my code [closed]

I tried to update the dictionary values but output is not as expected also i wanted to reduce the code complexity of the code. Could someone help me to reduce the cognitive complexity with optimized ...
user avatar
2 votes
0 answers
22 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
  • 137
1 vote
0 answers
34 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
614 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
379 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
141 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
15 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
60 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
63 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
70 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
40 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
766 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
  • 181
2 votes
0 answers
49 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
85 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
35 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
62 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
49 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
415 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
53 views

PyQt6 program that helps you categorizing items

Interface: Console output: ...
user avatar
4 votes
2 answers
75 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
39 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
66 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
123 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
682 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
663 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
59 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
256 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
85 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
58 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
78 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
39 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
80 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
79 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
0 votes
0 answers
32 views

Python one-line binary search

...
user avatar
5 votes
2 answers
185 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
108 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
0 votes
1 answer
38 views

Comparing custom Geometry classes (Lines and Planes): How to increase the accuracy of the __eq__ method

I'm creating custom classes to represent Planes and Lines on a 3d graph. To help improve the performance of my process I've started implementing __eq__ so that I ...
user avatar

1
2 3 4 5
101