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
3answers
56 views

Fibonacci generator python implementation

I wrote this code for a fibonacci sequence generator. Can anyone tell me whether my code is designed well? if not, why? ...
11
votes
1answer
992 views

A convenient wrapper for Telegram Bot library

I'm working on several projects involving Telegram bots and I've decided to make a library that meets my needs. Basically, there is already a Python library for Telegram bots (...
1
vote
0answers
454 views

Automatically checking argument types in commands of a Telegram bot

I am writing a simple Telegram bot in Python 3 using the python-telegram-bot library. A command is a Telegram message that looks ...
3
votes
3answers
62 views

SUVAT Calculator web app using python streamlit

I have made a calculator app to help Bengali high-school students in solving mathematical problems on Newtonian equations of linear motion aka SUVAT equations. I am using python version 3.8.3 and ...
2
votes
1answer
63 views

Stack Exchange Marathon Bot – Part 1: Bot structure

This code review is for my Stack Exchange Marathon Bot project, a Telegram bot for playing a dumb little game involving the Stack Exchange network. Since the codebase is not that small, in this post I ...
4
votes
1answer
78 views

Python: Matrix Manipulation module

I made a module called "matrix-py" in python to add, subtract, multiply, transpose matrices I want to know how to improve the code quality and if there's something wrong about my code here's ...
1
vote
2answers
64 views

Get data from JSON values

I have been working on where I want to improve my knowledge to do a safe JSON scraping. By that is that I could pretty much do a ugly workaround and wrap it into a try-except but that is not the case. ...
2
votes
1answer
39 views

Singleton handler for reading and writing configuration.json

In a current project of I have multiple modules that need to read from and write to a config.json file, where the settings are saved as nested dictionaries. I chose ...
2
votes
2answers
65 views

Cython Fibonacci Sequence

For my current job, I've been told that soon I'm going to be porting our Python code to Cython, with the intent of performance upgrades. In preparation of that, I've been learning as much about Cython ...
3
votes
2answers
95 views
+150

In memory “table” filtering in Python

I'm working on a mini-framework in Python, designed largely for backend REST APIs. One important aspect I'm working on now is testing, and I'm designing a drop-in backend replacement that switches it ...
2
votes
1answer
49 views

Python factory class with dynamic imports

I'm writing a factory class that allows the user to create objects based on provided keywords. The user will need to import the module and then use ...
3
votes
1answer
27 views

Frame Pacing and Animation in Python/tkinter

The goal of each frame of the animation to be the same length as the one before it, regardless of the amount of processing that takes place as the frame is being built. This is a little animation demo ...
2
votes
2answers
87 views

Scrape webelements

I have been working with requests where I as easy as it is. Scraping the webpage and add it into a dict and print the payload if we find a new value or not. ...
1
vote
1answer
27 views

Run python File With get request flask API

Code is Working Review and Recommend What Are Best Practice What I am trying to achieve. API with Flask that runs any python file from the current directory. Run the file and get output in JSON ...
1
vote
1answer
34 views

Multiple functions connected to SQL

I have created a thread before regarding the similar code review I had before Previous code review - I have updated a small piece of advice I got from previous answer and I did realized I have ...
9
votes
2answers
711 views

Return quarters of current year

I build this simple function, trying to use PEP 8 Style, something that I discovered recently thanks to this previous question. The function works, but I was wondering if there is a better way to do ...
2
votes
1answer
57 views

Mutilple functions connected to database

Today I have learned alot and still learning. I have came to a situation where I have realized that I have created a database with multiple functions that does similar stuff but different queries. ...
0
votes
0answers
23 views

Return screenshot data from subprocess without residual files

I have a use case, where I want to take screenshots via scrot without leaving behind residual files: ...
-1
votes
0answers
27 views

Python machine learning ValueError: ' ' is not in list [closed]

I'm writing a fairly simple AI chatbot that takes hardcoded inputs and outputs from a JSON file and determines which output to use for a given input. However, I'm getting a ValueError that reads ...
1
vote
1answer
5k views

Created a frame with a disabled button, till check button is used, then return to starting state

I've been coding Python for little over 6 months now. I am self taught and I would like to ask for some help for myself and also for others in my position who's been wondering if they're going about ...
5
votes
1answer
54 views

Async download of files

The following code is an async beginner exploration into asynchronous file downloads, to try and improve the download time of files from a specific website. Tasks: The tasks are as follows: Visit ...
1
vote
0answers
9 views

A thread-safe WebDriver pool to submit browsing jobs to

For a project, I need to make use of Selenium WebDrivers, and since they're so expensive to start, I decided to write a pool to manage them. ...
1
vote
1answer
69 views

A Tic-Tac-Toe AI based on two rules

So i made a tic tac toe bot with the following rules (its not unbeatable) ...
3
votes
1answer
38 views

Approximation search source reconstruction localization algorithm

Goal To determine the coordinates of some signal source in a 3D space, given the coordinates of four observers and the time at which each saw the signal, as well as the velocity of the signal. ...
6
votes
2answers
150 views

Flatten JSON to string

The code below is a Python module to flatten JSON-like structure (nested dictionaries and lists) to a single string. It also provides partial result in the form of flat list of strings. This ...
2
votes
1answer
49 views

Create a divisors list and identify primary numbers

I tackled a beginners' exercise: "asks the user for a number and then prints out a list of all the divisors of that number." The workflow I established is: input an integer number, say ...
3
votes
2answers
136 views

Timer convenience class to time code execution for user output

I implemented a convenience class to time code execution and print it to the user. This is part of a bigger project that will be distributed to external users. The timer however is only called by ...
7
votes
3answers
1k views

Python discord bot

So in my free time, I made a discord bot to play around with and learn a bit of python. I'm mainly a java developer. The bot has a few commands that allow it to find and output recipe for cocktails ...
0
votes
1answer
21 views

Forming a dynamic dictionary based on searched key and values pair using RAW logic and not modules of python

I am trying to create a dictionary with a file containing text based on a matched pattern. Lines containing key_str should become keys and subsequent lines not matching key_str should become values ...
6
votes
2answers
741 views

Enhance Sudoku puzzle generator

I wrote a Python script that generates a Sudoku puzzle. Everything works just fine but it takes too much time to generate puzzle from a completed board (remove_cells...
1
vote
1answer
75 views

Bank database program

I have been trying to improve my Python coding and was just wondering if there was a more pythonic way to perform what I have done so far, namely around the date in the ...
17
votes
4answers
34k views

RSA algorithm implementation in Python 3

First, a reminder of the RSA algorithm and what my program implements: Take two distinct, large primes p and q Ideally these ...
4
votes
1answer
62 views

AVL Tree implementation Based on VisualGo

I have tried implementing an AVL Tree on my own, based on visualising it. But i'm unsure how many testcases it work with, and how efficient it is. Are there any ways to make it efficient, and compact? ...
4
votes
2answers
47 views

Radix Sort Speed

I have implemented a radix sort algorithm in Python 3. It first finds the maximum number of digits in the list, then changes them to strings and adds 0's. For example, [7, 23, 107, 1, 53] to ['007', '...
2
votes
1answer
19 views

Reducing running time of creating integration field in flow field algorithm (python)

The integration field needs to get recalculated every time the starting or goal coordinates change. I wanted to use the flow field algorithm for a problem that includes bigger mazes with changing ...
5
votes
3answers
122 views

Optimizing an implementation of the RKF method

This is an algorithm regarding the RKF method: ...
1
vote
0answers
31 views

Open and update csv file

...
3
votes
1answer
135 views

Given an integer array A and a range, find a subarray within the range with a minimum sum

Problem HackerRank Range query: You are given an array A of n integers. You have to perform ...
8
votes
3answers
413 views

Print receipt from cash register in Python

Problem Output a receipt of purchased items. Inputs: products_text_path: Products are found in a text file in <barcode>:<name>:<price> line ...
3
votes
2answers
75 views

Function for checking if a string is a path or an URL be improved

I made myself a function to check if a string is a path or an URL: ...
3
votes
2answers
85 views

Parsing a text file into a pandas DataFrame

I have a .txt file that looks like this: ...
0
votes
0answers
11 views

Filter string depending on filtered & unfiltered keywords

I have worked on a small script where I check if the given string is a filtered or unfiltered keyword. Basically if its filtered then we want to add a additional key to dict. with value True, if its ...
1
vote
0answers
38 views

validation and test loss for a variety of PyTorch time series forecasting models

Hi everyone I'm trying to reduce the complexity of some of my Python code. The function below aims to compute the validation and test loss for a variety of PyTorch time series forecasting models. I ...
3
votes
0answers
48 views

Toy neural network give poor results

I'm a beginner both in Python and Tensorflow. I made a toy neural network to learn both. The objective of the NN is to identify the module c, or separation between lines defined by random points, and ...
0
votes
1answer
63 views

for loop in one line (for python -c)

I want to use python -c to remove wheel files from the dist/ directory in my project. (*) Actually, I use the following command: ...
3
votes
1answer
82 views

Optimizing Dijkstra on grid Python (Microsoft Interview)

Given a square grid of size N, each cell of which contains integer cost which represents a cost to traverse through that cell, we need to find a path from top left cell to bottom right cell by which ...
0
votes
0answers
14 views

Markov Chain Monte Carlo (MCMC) wind simulate

I want to generate wind data with the use of MCMC. The results I am getting are quite off from the measured mean values not sure why. SIMULATE WIND DATA ...
3
votes
1answer
37 views

My 'almostIncreasingSequence(sequence)' code is too slow for lists that have 10000+ elements. [CodeSignal]

I asked this question on Stackoverflow as well, but I think it's best suited here because my code needs optimization instead of error checking (that I previously thought). I've made changes to my code ...
20
votes
6answers
3k views

Password validator

I have made a password verification "program" which takes user input and checks whether the password is valid or not. Based on that, a reply is printed. ...
1
vote
0answers
16 views

Nintendo Switch emulator log analysis Discord bot

This is my first attempt at open source contribution via a Python discord bot, built to analyse user-uploaded log files and give quick, at-a-glance information for support staff. The PR is here: https:...

1
2 3 4 5
92