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
3
votes
3answers
91 views

Summation of large inputs

Assume we are given \$ n \$ natural numbers, \$a_{1}, a_{2}, \dots, a_{n} \$ and we are supposed to calculate the following summation: \$ \sum_{i = 1}^{n}\sum_{j = 1}^{n} \left\lfloor \dfrac{a_{i}}{a_{...
9
votes
2answers
708 views

Applying random luck scores to instances of people

I'm trying to do a simulation on the role of luck in human achievement. Here is what I intend to do with my code: Create 20000 instances of people with randomly generated scores for skill, experience ...
-4
votes
0answers
13 views

Want to release the stable version on github [closed]

Recently i made a project posted on github and thats a beta release i am the solo devloper for that Github Link i want someone to review my code and library and suggest me something so i can release ...
1
vote
1answer
38 views

Applying stacking penalty rule in Daily Fantasy Football

My program applies stacking penalty rule in Daily Fantasy Football by choosing which players to be penalized by which amount of points. The rule is about penalizing teams with two or more defensive ...
4
votes
1answer
35 views

Geocoding addresses from a SAP database

I'm new to python and curious if this is the most efficient way to read addresses from a SAP database, geocode them, read the results, and then write the information back to the database. Everything ...
2
votes
1answer
21 views

Functions that Find Tokens, Replace Tokens, and Retrieve Property Values from Dictionaries

The module has three functions: get_property_from_dict, retrieves a dictionary property's from a given path. token_collect_from_dict, builds a list of tokens and their location from a given ...
3
votes
1answer
58 views

Cyclic generator with access to current local state and executes callback after each cycle

I'm working on a Python class that is a cyclic generator, like itertools.cycle, but it offers access to its current state and executes a callback after the ...
-2
votes
0answers
25 views

The sudokus I am generating has more than one possible value [closed]

I am making an amateur sudoku application with tkinter, and I just completed the logic of the system (the generator and solver), and it seemed to me that it worked perfectly, until I checked the ...
1
vote
2answers
138 views

Python YouTube Video Downloader

I'm looking for some feedback on my first 'real' Python program. Started with Python a few days ago and wanted to get right into it and make something hands on. Currently the program lets you download ...
3
votes
2answers
534 views

Instagram Scraping Using Selenium - Download Posts - Photos - Videos

Python script that can downloads public and private profiles images and videos, like Gallery with photos or videos. It saves the data in the folder. How it works: Log in in instragram using selenium ...
6
votes
7answers
11k views

Hacker rank 30 days of code Maximum Sum of Hourglass

I came up with this code as a solution to a contest question. The original question can be viewed here for attribution sake: Hackerrank 2d array problem Sample input is like this: ...
4
votes
2answers
52 views

Modifying __getattr__ to return a nested attribute instead of the named object

I'm writing an application with two basic class types: DocumentObject Property (of document object). Property instances are attributes of the ...
10
votes
4answers
1k views

Chess Tournament Simulator

I wrote a simulator that simulates chess games. The game uses probability to determine the player that is most likely to win. though they might be upsets(a low rated player winning the game). I would ...
3
votes
1answer
57 views

Simple Hangman game in Python3

I made a simple Hangman game in Python: ...
6
votes
2answers
79 views

Redistributing times

Original problem: Given \$x\$ number of tests that should run in \$y\$ number of seconds shift the time per test so that each test takes a little longer than the next. Example: If running 10 tests ...
2
votes
1answer
98 views

Algorithm Optimization — Automatic Dimensionality of PCA

I have implemented (rather, edited the implementation of) a technique to automatically detect the optimal number of dimensions for PCA, based off of this paper. This was inspired by ...
1
vote
1answer
65 views

Project Euler 8 - Largest product in a series [closed]

The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 73167176531330624919225119674426574742355349194934 ...
-5
votes
0answers
16 views

optimize python function to search an artist in a json file [closed]

I developed a REST-API by myself, and this is the function for searching through a json file for an (music)-artist. Now I wanted you to ask if there are possibilities to optimize my code ...
5
votes
1answer
206 views

Simple bank-atm system design OOP

For practicing designing systems I created a simple bank ATM system. I didn't want to make it to complicated so I left out things like cash bin per ATM and opening cash trays, etc. I also wanted to ...
2
votes
2answers
72 views

Persist keyboard backlight color on Linux laptop

System76 sells laptops that come preloaded with their Ubuntu spinoff Pop_OS. The laptop keyboards have backlights that can change color and brightness, but so far I haven't found any way to keep the ...
1
vote
0answers
28 views

Resource reservation system

I'm using a function to determine if resources can be used again or not. This is the numpy array I'm using. ...
6
votes
3answers
68 views

Guess the number Feedback Please

I started learning Python these days and made my first code. Guess_The_Number and I would like some comments to improve or if I am on the right track. Thank you very much in advance P.s: I am trying ...
-2
votes
1answer
16 views

Image shows normally on simple program, but appears blank when I introduce it to mine (Tkinter) [closed]

I am trying to show a graph on the screen that I just plotted using matplotlib on python. Basically, my program receives a bunch of parameters and then makes a graph, that should be displayed on ...
0
votes
2answers
75 views

Python3: using generator to process a very large list of integers

This is from a leetcode question I am working on. The problem is the following: create an algorithm that works in the the following fashion: arr = [1,3,4,8], queries = [[0,1],[1,2],[0,3],[3,3]] the ...
-1
votes
1answer
66 views

Dollar/Riyal currency converter in Python

...
6
votes
2answers
79 views

Web scraper for driver's license test times

I have created a small selenium script that checks for available times to write a test for a drivers license. The program runs every minute and takes approx 50 seconds to run. I have noticed that it's ...
0
votes
0answers
9 views

Convert JPG to H5 and plot the images

I'm learning ML/DL and found the process of getting the data and labels quite tedious. There is not much details on how to get JPG files into H5, which is (afaik) the only way to work smoothly later ...
1
vote
1answer
1k views

Clustering using k-medoids

This is the program function code for clustering using k-medoids ...
1
vote
1answer
28 views

Processing Batch Job

Background I have a script that either takes a text file that contains a list of player_ids or not. If the user provides a ...
0
votes
2answers
48 views

Stack based Calculator in Python

I programmed a calculator with int operations. The calculator stores functions in a dictionary. Also, the calculator stores how many arguments the function takes in a dictionary. The input format is ...
11
votes
2answers
421 views

Segmented wheel Sieve of Eratosthenes in Python

Here is a new version of a segmented and wheel factorized Sieve of Eratosthenes. It currently uses mod 30 wheel factorization to eliminate multiples of 2, 3, and 5 in the sieve data structure to gain ...
1
vote
0answers
56 views

Thread Safe Python Client Server Service

I had like to get some feedback about my Thread Safe Python Client-Server example. Is it really thead-safe? Do you see any dead-locks or other thread-safe problems? https://github.com/icarpis/...
1
vote
0answers
37 views

Efficient Multithreading in Python 3 - Webscraping behind a login

I'm a total beginner at Python and I would like someone to rate my code and to give me tips about talking between threads in Python. I don't know if I need these much threads for this script, but by ...
3
votes
1answer
11k views

8-Puzzle using A* and Manhattan Distance

I have developed this 8-puzzle solver using A* with manhattan distance. Appreciate if you can help/guide me regarding: 1. Improving the readability and optimization of the code. 2. I am using sort to ...
5
votes
2answers
444 views

Basic python GUI Calculator using tkinter

Could anyone review my code for a calculator using tkinter? I'm attempting to use two classes, one with the functions of the calculator and a second which creates the GUI. It seems to work fine (...
5
votes
1answer
128 views

Handling exceptions in Python 3

Please can you review my standard exception handler for Python 3.x. It is located under the # +=+= line. The code above the line is to create an exception and so ...
2
votes
1answer
27 views

Combinatorial Geometry Algorithm (synthetic)

I created an algorithm to solve in synthetic geometry. This problem states that these points are a scalar (real) number. The goal is to first make the possible triangles from the line segments. Then ...
2
votes
1answer
54 views

Dijkstra's algorithm in graph (Python)

I need some help with the graph and Dijkstra's algorithm in Python 3. I tested this code (look below) at one site and it says to me that the code took too long. Can anybody suggest how to solve that? ...
-2
votes
0answers
48 views

Largest sum of non-adjacent numbers [closed]

Given a list of integers, write a function that returns the largest sum of non-adjacent numbers. Numbers can be 0 or negative. Examples: [2, 4, 6, 2, 5] should ...
1
vote
0answers
28 views

Divide a set into subset with some constraints

Note - I am not sure whether this question belongs to stackoverflow or CSE stackexchange or here Problem: Given a list Lconsisting of not necessarily unique non-...
3
votes
2answers
61 views

Timer with interval function

I've been tasked with writing a function that executes a passed function every interval, passed to the function by the user. Below is the code, and how to call it: ...
16
votes
2answers
1k views

Car computer in python / GPS tracking

I have an old car that I use for long distance driving and have coded an onboard computer based on a Raspberry Pi 3 and a few other modules. It's my first project in Python and while I've already ...
8
votes
3answers
869 views

Find website URLs that begin with http:// or https://

This is a problem from Automate the Boring Stuff from "Pattern Matching with Regular Expression". I am a beginner in Python and the purpose of this program is to match urls which start with ...
13
votes
4answers
2k views

Shop system for an RPG in Python

I built a shop system for a Python text RPG I'm making. It repeats itself more than I would like. I was thinking I could use dictionaries to make it better but I'm not sure how. Anyways, how is it? ...
2
votes
1answer
92 views

Find minimal modulo-sum of pairs from two lists

Recently I appeared for an job challenge organised on HackerEarth. Question: There are two teams T1 and T2. Power of each player is represented in array. The rules of game are as follow. There are ...
5
votes
1answer
61 views

Dynamic DNS IP Checker/Changer for Google Domains in Python

I needed a way to automatically update my IP forwarding rules on Google Domains for my home web server running behind my router. (I'm not paying for a static IP!). After writing a simple functional ...
6
votes
1answer
123 views

Parsing a JSON one line at a time in Python

happy 2021 everyone! I started coding some months ago for fun and recently I challenged myself to build a JSON parser in Python (v3.8). The basic idea was to avoid loading the whole file at once, ...
3
votes
1answer
27 views

Another Sliding Window - find each `k-size` window the maximum num. from an integer array/list

I've searched this site and find many similar questions, but not exactly the same as the one I'll post. This attempts to solve Leetcode 239: You are given an array of integers ...
4
votes
1answer
2k views

Socket chat room made with Tkinter Python

This is a real live chatroom that I have made with Tkinter I posted a question before about making a chatroom but the problem that I had with that one was that only one user could connect to the ...
3
votes
2answers
115 views

Python word guessing game

...

1
2 3 4 5
90