Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
4
votes
2answers
105 views

Get list of all combinations from a set

Given a tuple of elements, in elementTupleParam and the number in each combination r, we compute all the possible combinations ...
10
votes
4answers
748 views

Shuffling multiple iterators in order

I have a Python function w/ specified functionality, and two proposed approaches - which do you prefer, and why? (performance, simplicity, clarity, etc) (both use ...
6
votes
2answers
467 views

Determine if input word can be created from a list of letters

I am looking for a more elegant way to validate in an input word can be created from a list of letters. ...
2
votes
1answer
75 views

High Speed Python Web Scraper Optimised

I needed a lot of data for a tensorflow project so I made a web scraper to get all of the text and links off of websites then to repeat the process at all of those links. I left it on overnight and ...
9
votes
2answers
420 views

My second game: War Card game V.1

I'm a beginner programmer that's really motivated at the moment. I made this in two days and I'm really proud of it because I never used any tutorials or any online help. Just good ol' grey matter and ...
3
votes
1answer
42 views

Recursive Merge Sort Algorithm (Python)

Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Just for ...
7
votes
3answers
92 views

Blog with Python/Flask

I've written a blog site using python and Flask. It works a little like Reddit, but instead of having some anonymous users, ...
3
votes
2answers
107 views

Binary Search Tree implementation in Python 3

Please review my BST Code 1. Class node class Node: 2. Constructor ...
10
votes
1answer
841 views

My first Hangman game in Python

This is my first game and I'm really proud of it, but I think it's horribly messy. Is there any way to improve it? ...
6
votes
3answers
99 views

Battleships OOP python

This is my first attempt at some basic OOP programming. A version of battleships played within the terminal. Any feedback would be great; especially in regards to readability and proper naming ...
5
votes
1answer
54 views

Bank account balance program

Would my code be considered fairly optimal and efficient? If not, where can I look to improve the code? The program works just fine. Would this method scale well if the dictionary containing the ...
3
votes
1answer
38 views

Network programming - asynchronous, single-threaded, nickname-only chat server

I am starting to learn network programming. I have implemented a very simple chat server based upon TCP, where the users only need to provide username. The assumption is that the server makes use of ...
12
votes
5answers
1k views

Comma Code - Automate the Boring Stuff with Python

Below is my code for the Comma Code problem from Chapter 4 of Automate the Boring Stuff with Python. Is there anything I can do to make it cleaner? Comma Code Say you have a list value like ...
3
votes
1answer
42 views

Script that saving most relevant Youtube video for each database object

Due to the tightened Youtube API daily quota (that allows to use only ~ 98 search requests per project daily) I've implemented a multi-project system. For this to work you need to create a project/...
3
votes
0answers
24 views

SageMakerTrainingOperator in Airflow

I have made an operator (surrounded by others operators) for training a model in sagemaker in airflow and I have doubts how would it be more readable or more pythonic. First I did this: ...
5
votes
3answers
51 views

Symmetric Tree Check in Python

Inspired by This LeetCode Question. Instead of checking if every layer is symmetric, it instead checks if any aren't. This allows the program to leave early is an early layer fails the test. I'm ...
1
vote
1answer
59 views

Bank account class

Simple object-oriented, money management code where a user can deposit money in, withdraw from, show, and exit the balance. ...
3
votes
2answers
58 views

FAMILY.PY | OOPython

Simple code where family and person instances can be created. There is a method where any instance of Person can be added to any instance of Family. ...
9
votes
1answer
126 views

Maze image solver and animator in Python

This maze solver is a continuation to the maze generator I posted here recently Maze generator & animator in Python This code takes an image containing a 2-color maze as input and solves the maze ...
5
votes
2answers
118 views

Wrapper for Python's argparse class

I'm just trying to learn python: I tend to write my own customized wrappers arround "more complicated" python functionalities so that i can use them more easily, more consistent, easier to change in ...
15
votes
5answers
2k views

Performance for simple code that converts a RGB tuple to hex string

I'm rewriting a full color Mandelbrot Set explorer in Python using tkinter. For it, I need to be able to convert a Tuple[int, int, int] into a hex string in the ...
2
votes
0answers
22 views

PySide2 Row and Column Creator

In short, I need help simplifying and optimizing this code because now that I have switched to a tree widget from 2 list widgets, loading the tables has increased by roughly 3-4 seconds (used to be ...
11
votes
6answers
1k views

Pseudo Game of Cups in Python

DESCRIPTION: [Inspired by Chandler's GameOfCups with Joey in "Friends"]. Program gets 5-digit zipcode from user. (Assume user won't make a mistake, and will enter exactly 5 digits). ...
4
votes
1answer
47 views

Extract, filter and match three letters from the given arguments and predict the name

Case 1: rank1_naming This function takes two arguments list_proteins_pattern_available best_match_protein_name Objective: Extract the three letter pattern from the both arguments. Match the ...
3
votes
2answers
69 views

Determine if a string is a sequence of dictionary words

This is Leetcode problem 139: "Wordbreak" Problem: Given a non-empty string s and a dictionary wordDict containing a list ...
4
votes
2answers
58 views

Run the needle program for a query against the subject files and return the result

I have written the script to run locally the needle program for a query against the subject files. It returns the highest percentage result file as a string. In addition it also converts to html file (...
2
votes
1answer
50 views

Plotting a parabola using Tkinter

I'm a beginner, and I have just written this basic code that simply plots a parabola in a graph. Is it possible to make my code more efficient? The process works by the creating lists of X and Y then ...
12
votes
4answers
932 views

Account creation and log-in system

I've been learning Python for about 1 - 1 1/2 weeks now and just finished my first small project to help solidify what I've learnt. It's a very basic (bad) login / create account system that I run in ...
3
votes
3answers
182 views

merge list of strings into one sorted string

So I was tasked the following: Given a list of strings, output a sorted string that consists of all lowercase characters (a-z) from each string in the list. Example [aba, xz] -> ...
5
votes
3answers
123 views

Effective fetching data algorithm

I'm fetching some data by using bs4, and want to know why access speed gets slower as my program progresses. I'm using thread, and I know threading isn't so fast because of GIL. My problem is that ...
1
vote
1answer
71 views

What should I change in my currency converter? [closed]

I wrote a simple currency converter in Python. Right now, my currency converter converts using the last available rate or converts using a specific date. Looking for: I'd appreciate any tips ...
1
vote
0answers
44 views

MATLAB / vs Python np.linalg.solve, heat diffusion, Why Python is slow? [closed]

I am solving a simple 1D steady heat question using spectral method. I am a long time MATLAB and Mathematica user and trying to learn Python. I compare only linear solving times and Python is way ...
4
votes
1answer
48 views

Finding all simple (without internal cycles) paths in a directed graph with total >1.0 weight

Assume directed graph with each edge being weighted by some positive float. Problem: find all simple paths (in other words, ...
2
votes
0answers
51 views

Django Dashboard View

What does my code do? I use Django and in the following snippet, I use a class together with a TemplateView to render an HTML page. I already tried to simplify it with methods, but my code still looks ...
3
votes
1answer
86 views

Convert text file to html?

I have a script that converts a text file to html. The text file is an output of a program (needle). The function takes the text file as an input. I am aware the script is awful. I use this function ...
11
votes
3answers
500 views

Mutable named tuple with default value and conditional rounding support

I have following code to create a mutable namedtuple. based my understand I can use dataclass to do it. is there a better way to do it or clean up the code? ...
7
votes
4answers
324 views

Sort files in a given folders and provide as a list

I have two folders query and subject. The following function sorts alphabetically and provides the query and subject as a separate list. The file names are mixed of numbers and I found the sort ...
9
votes
2answers
104 views

Simple Python3 Checkers

I'm a beginning "pythonist" my current task is to write a checkers game and I need some suggestions here and there: are the code style and literacy answering the criteria of python? are the modules ...
3
votes
1answer
92 views

Simple calculator in Python

This is my first ever Python program. I thought I would make a calculator that performs 5 operations: add, subtract, divide, multiply, power. I am aware Python has its own power function, called "pow",...
3
votes
1answer
51 views

Run an external program and extract a pattern match along with the result file

The script takes two input files of protein sequences and runs an external program (installed in linux/MacOS). The result provides a text output file example output.. Identity percentage is extracted ...
1
vote
2answers
60 views

Extract three letter pattern from a given list

The code takes a list of names and extracts the three letter pattern from the names. Then return the list of names as a value in the dictionary with key as a pattern. The list name has a fixed naming ...
13
votes
2answers
976 views

Mean π: Archimedes vs. Gauss - π computation through generalized means

I've written this simplified code to compute Pi for educational/demonstration purposes. These methods are based upon the generalized means: see a presentation on Pi and the AGM. Archimedes' method ...
5
votes
1answer
87 views

Python/Flask Password Manager

As a project to better my skills in Python, I wrote a password manager. It's a website that has user login/logout functionality, the ability to add websites and passwords, and displays the websites/...
1
vote
1answer
58 views

Personal quiz with input validation

The object of the code is to prompt the user with a quiz and collect the g's, y's, 0's, and 1's and if there is more than one then the user passes (else, they fail). I am a beginner and would like to ...
5
votes
1answer
34 views

CandidateArchive for model-assisted multi-fidelity global search algorithm

For my research I'm working on global search methods where a candidate solution can have it's fitness (=score) evaluated in multiple fidelities (=accuracy levels). The goal of the ...
2
votes
1answer
76 views

LeetCode - Merging piles of stones

This is a LeetCode Problem You have a pile of stones presented as an array. On each turn you must merge k consecutive piles of stones, starting from any pile you wish. You must continue merging ...
-1
votes
1answer
41 views

Python ANN Implementation [closed]

I recently learned about backpropagation online and tried to implement it. I am not sure I have it correct yet. I am confused and would love a second pair of eyes on this code. Please help me ...
14
votes
1answer
631 views

Maze generator & animator in Python

This is a follow up to this code and I still did not get the feedback on the drawing functions Maze generator in Python- Gif animator-Custom colors/sizes The code generates custom color and size ...
3
votes
3answers
111 views

(Project Euler #1) Find the sum of all the multiples of 3 or 5 below 1000

I have decent experience in programming before (mostly C++), but I am very, very, very new to Python, and I decided to try out Project Euler as an exercise. Here's the description of Problem 1: If ...
7
votes
2answers
777 views

Python implementation of atoi

I made an implementation of atoi (ascii to integer) in Python a while ago for fun, and I'd like to know what I could do to improve it. ...