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.

370 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
0answers
160 views

Population dynamic simulation on biological information maintenance 2

This question is the follow-up to this previous question. Background Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
7
votes
0answers
472 views

Let's register that Django user

Short intro So, I've been using Django for a while now and thought it would be nice to start a simple application. In an ideal World, each app must have a way of letting its users register and that's ...
6
votes
0answers
61 views

Simple integration of async and tkinter in Python

I've been a fan of coroutines and asynchronous programming for a while, and I recently took a trip down memory lane to when I was using Python's tkinter module for ...
6
votes
0answers
6k views

Example of multithreading in Python3 / PyQt5 using QThread

I wanted to make a simple example of multithreading with QThread in PyQt5 / Python3. The script generates a set of QLineEdits and buttons to start and stop a set of ...
6
votes
0answers
6k views

A game of NIM (Basic AI strategy)

I tried creating the game of NIM in python. I researched a couple of videos on how to always win at NIM. Eventually, I found a method and i was able to implement it in my code. This is the result... <...
6
votes
0answers
3k views

Real-time bitcoin data feed and storage using websocket framework

I'm trying to create data feed script for real time bitcoin data for OkCoin exchange using their websocket API (documentation) and a database manager for storing. There are two channels I am ...
5
votes
0answers
63 views

Parsing Long Excel Report Files for Predefined Results

I work as an IT intern in a multinational and I was given a tedious task of combing through a 2500+ long multi-column excel report file in search of inactive servers. Here's a sample row from that ...
5
votes
0answers
60 views

Cubic spline interpolation in Python from scratch

I implemented the cubic spline interpolation explained in https://en.wikipedia.org/wiki/Spline_interpolation as a Python class. Of course, such an interpolation should exist already in some Python ...
5
votes
1answer
79 views

Implementation of Singly Linked List

I'm a data scientist attempting to build stronger CS fundamentals, particularly in Data Structures & Algorithms. Below is my attempt at implementing a Singly Linked List. Looking for advice ...
5
votes
0answers
185 views

Secure Password and Passphrase Generator in Python 3

I'm aware that people have implemented password/passphrase generators before, but I still went ahead and wrote my own, which I actually use for my own passwords and/or phrases. By "secure", I mean ...
5
votes
0answers
43 views

Comparing same-size files and reporting on the differences byte-by-byte

I created a small Python utility to analyze multiple same-size files and report on the difference byte-by-byte (i.e. Hamming distance, not Levenshtein distance.) I am planning to extend the ...
5
votes
0answers
399 views

Asyncio HTTP Request Queue

I wrote a simple sitemap.xml checker using asyncio and aiohttp. I followed the documentation demonstrating the producer/consumer pattern. However, I noticed that as the URLs scale larger, it seems to ...
5
votes
0answers
83 views

Implementing numerical integration in Python

I have this Python code that implements a rectangular numerical integration. It evaluates the (K-1)-dimensional integral for arbitrary integer \$K \geq 1\$ $$\int_{u_K = 0}^{\gamma}\int_{u_{K-1} = 0}^...
5
votes
0answers
70 views

“Backend” of custom app made for editing Google Spreadsheet file

I've been learning some basics of python for few moths now. My friend, who works as salesman at company which sells hookahs, asked me if a could write a simple app which would help him maintain a ...
5
votes
0answers
495 views

Parsing different categories using scrapy from a webpage

I've written a script in python scrapy to parse different "model", "country" and "year" of various bikes from a webpage. There are several subcategories to track to reach the target page to scrape the ...
5
votes
0answers
547 views

Start a sub-process (with sudo) as head of new process group, kill it after timeout, get the output

This is a bit of a tricky one ... I am writing a test suite for a Python project - running on Linux. As part of the tests, I have to fire up various commands (shell commands, small CLI tools, Perl ...
5
votes
0answers
499 views

Ramachandran plot (plotting the torsion angles of protein backbone)

I would like to have some insights on the code I created. It would be really insightful for me to get some feedback about the code, what I should do differently, if there is an easier, more elegant ...
5
votes
0answers
394 views

Writing a metaclass to ensure a class is thread-safe

Python allows the creation of classes to be modified via metaclasses. They can perform all sorts of operations that might appear to be magical to languages that do not have the capability. The goal of ...
5
votes
0answers
694 views

Implementing an enum field for peewee.Model

I implemented an enum field class EnumField inheriting from peewee.CharField. The reason that I use a character-based field is ...
5
votes
0answers
947 views

Fibonacci heap in Python

I have this implementation of the Fibonacci heap in Python: ...
5
votes
0answers
101 views

Tokenizing and sorting the strings of a text file with the results of a public competition

I made this script to carry out a specific real-life task, which was to sort a list of candidates in a public competition by grade. The file with the informations consists of a text file copied from ...
5
votes
0answers
136 views

Selection sort with reduced comparison count: Python iteration 2

Follow up to Selection sort with reduced comparison count - semi-final Iteration? My goal (and excuse not to tag reinventing…) is to have presentable code to argue the viability of reducing the number ...
5
votes
0answers
85 views

Python tool to reduce number of resistors in circuit

I've written a tool in Python to help me with a specific problem I have with electronic circuit design. Here are the motivations: It is common in circuit design to need to choose two resistor values ...
5
votes
0answers
82 views

Artificial perceptron in python3

I have designed a very basic perceptron (single layer neural network) that has been mostly successful in learning basic linearly separable problems. The perceptron in defined as a class with ...
5
votes
0answers
471 views

Django blog application - views, urls, models, forms

I want to learn how to create websites and I have started learning Django web framework. I think Django is very good alternative for PHP and it isn't too complex as JEE. I'm very satisfied learning ...
5
votes
0answers
665 views

Cyther: The Cross Platform Cython/Python Compiler (Take 2)

I recently posted an earlier version of this code on Code Review, and now with the given suggestions and many other improvements, I am back. I included the description of exactly what Cyther is ...
4
votes
0answers
41 views

Scraping a hiring website using python's requests and BeautifulSoup

I'm designing a scraping application using python, requests and BeautifulSoup4. I decided to divide the logic into two classes: Spider : gets the base url ...
4
votes
1answer
93 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 ...
4
votes
0answers
24 views

Python automatic import and install script

In the following script, I am trying to infer if the modules are managed by a conda environment or not and based on that, I am trying to auto install and import the modules. [I skipped around 5 to 6 ...
4
votes
0answers
28 views

Asynchronous Stripe API and aiohttp parameters formatting

I'm testing the Stripe payment API. I couldn't find a Python wrapper that provides asynchronous requests so I'm writing one. My first goal was to implement the async equivalent of ...
4
votes
0answers
33 views

Python: Exception handling in a logic gate

I'm learning about Python and am going through the OO-stage where I'm building a set of logic-gate classes. To make the logic more resilient, I only want the user to be able to enter a value of 0 or ...
4
votes
0answers
76 views

Initial map modelling for Battleship game

The goal of the code below is limited to the creation of the initial map only and not to the whole game mechanics itself. The rules are that there are 4 ships of length {2,3,4,5} and no ship may be ...
4
votes
0answers
59 views

Game clock with configurable rate

Edit: Licensed source can be found here. The intent behind this class is to allow different game systems to run at their own clock rate. The physics integration rate should not be connected to the ...
4
votes
0answers
38 views

Blackjack CLI in Python 3

This is a simple CLI Blackjack game in python3. I saw that there were others already posted here and tried to implement some of their solutions and logic where I understood it. My game is a little ...
4
votes
0answers
49 views

Basic Python HTTP Server

It's an extremely simply HTTP server in Python using the socket library, and a few others to get the MIME type, etc... I've also avoided the ../../ vulnerability, ...
4
votes
0answers
52 views

Decorate a python function to work as a Google Cloud Function

I wrote this for a class project, the backend for this dog voting website. I noticed duplicate code among multiple functions I was writing to be deployed as a cloud function: they all were wrapped in ...
4
votes
0answers
39 views

Convert Amazon transaction data for import into accounting system

At the end of each billing cycle, Amazon generates a raw transaction file for my store's orders that cycle. I am converting that raw transaction file into a .csv file to be imported into my accounting ...
4
votes
0answers
38 views

Iteratively Build a Summary Dataset in an Effective Way

This is a problem I find a lot!! Can I achieve this goal without consuming so much time? My code below achieves what I want it to achieve. However, I believe it could be a lot more efficient and ...
4
votes
0answers
53 views

graphtimer v2 - Utility to plot timings

GitHub repo (MIT) Clone the repo and replace the contents of example.py with the one at the bottom and you'll have everything setup. Explanation of the code A ...
4
votes
0answers
85 views

Faster algorithm to tailor given mathematical expression

Is there a more optimized solution to solve the stated problem? Given an array 'arr' of 'N' elements and a number 'M', find the least index 'z' at which the equation gets satisfied. [ ] is ...
4
votes
0answers
162 views

dynwg: A DynDNS watchdog for WireGuard via systemd-networkd

Preface I'm using WireGuard as a VPN solution to connect a remote client permanently to my home server. Unfortunately due to Consumer DSL-related IP address changes, the client loses the connection ...
4
votes
0answers
60 views

Wrapping argparse to use configuration file

I want to be able to both provide options through command line and from a configuration file. A single option could be served either by the user or by the configuration. But if is provided by both, ...
4
votes
0answers
171 views

Pentominoes in Python

I'm currently coding a game of Pentominoes and I would like to hear suggestions on how to improve my code and make it more pythonic. Rules and goal of the game There is an 8x8 grid and you have 12 ...
4
votes
0answers
77 views

pool of python coroutines

Task control how much coroutines are running simultaneously with ability to stop the process from inside. Use case when scraping websites you want to control how much memory program consumes and ...
4
votes
0answers
543 views

Game of Life simulator, Python 3

Using Python 3.7.0, I've programmed a 'Game of Life' simulator. The output is displayed using tkinter. It's not meant to be limited to just Game of Life, though, as it's meant to also be used for a ...
4
votes
0answers
319 views

Tic Tac Toe engine in Python for Deep Learning

I'm implementing a Tic Tac Toe engine that will work with deep learning. I'm using a 3x3 numpy array of floats to represent the board. +1.0 represents an X, ...
4
votes
0answers
1k views

Implementation of binary search tree

I require a code review in terms of correctness, style consistency, efficiency, code readability, and "pythonic"ness. ...
4
votes
0answers
163 views

Distributed TensorFlow | VGG 16

I am trying to develop a VGG 16 model distributed over a single server. I have one available GPU server with 1 CPU and two GPU cards. I have the code to treat them as different servers and implement ...
4
votes
0answers
6k views

(Python) Use IMAP lib to download attachments and email details

This is my first approach to programming in Python, so I hope you will "destroy" my coding! Idea is to use SSL connection to my mailbox and use IMAP to download attachments from emails with ...
4
votes
0answers
2k views

UDP chat program with server, client and listener

This is a little chat program that I have been working on and I want general feedback such as feature suggestions, efficiency comments, etc... The server will setup a DGRAM socket and constantly ...