Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.

learn more… | top users | synonyms (1)

1
vote
1answer
16 views

Converting string to a set of integers

So I get a user input of a lot of numbers in a single line like this 100 100 200 300 300 300 400 500 500 700. I want to store the distinct ones in a list. A ...
2
votes
2answers
27 views

Parser for Facebook friend list

I have written some code in python in combination with selenium to parse all the names from facebook friend list. It was hard to manage the pop up notification and the process of scrolling to the end ...
4
votes
1answer
50 views

Parsing a file using PyParsing

I'm trying to parse a file of about 200 MB in size. I decided to use Python re module for this task. However, upon some further study, I found that the BNF grammar-based PyParsing provides what I'm ...
-1
votes
0answers
15 views

Redundant_map (Recursion) [on hold]

enter link description here """ Complete redundant map, which takes a tree t and a function f, and applies f to the node (2^d) times, where d is the depth of the node. The root has a depth of 0....
9
votes
2answers
435 views

Printing a calendar for a month based on user input

I have a long piece of code that has many repeating points. I am sure that it doesn't take this amount of code to create a simple calendar, but I do not know how to shorten this piece of code. ...
0
votes
0answers
37 views

Find every two vowels inbetween a consonant [on hold]

Task You are given a string . It consists of alphanumeric characters, spaces and symbols(+,-). Your task is to find all the substrings of that contains or more vowels. Also, these ...
5
votes
1answer
467 views

Choose random instants in a day with a low memory footprint

I'm looking for a way to plan a list of X events at the start of the day... What I did before: At 02:00 every day, choose X timestamps from "now" to 01:59 the next day. That worked well but I had to ...
6
votes
1answer
46 views

Python 3.x Hexdump

I posted a small hexdump generator function from a program I've been writing not long ago and applied what a reviewer suggested since then. The goal was to lazily hexdump bytes objects (byte strings, ...
4
votes
2answers
56 views

MySQL parser written in Python3

As the title suggests, I'm building a MySQL parser in python. The intention of this is to better support application development by managing migrations in a more declarative way. You can read about ...
3
votes
1answer
41 views

Scraper for parsing email-ID using email sending button

I've written a script in python with POST request which is able to send email using send button and then catch the response of that email and finally parse the ID from that. I don't know whether the ...
4
votes
1answer
62 views

Scraping the full content from a lazy-loading webpage

I've written a script in python in combination with selenium which is able to scrape 1000 links from a webpage in which lazy-loading method is applied for that reason it displays it's content 20 at a ...
8
votes
2answers
92 views

Procedural style Rock Paper Scissors game using Python 3

I am a newbie to Python and am trying to do the Rock, Paper and Scissors game to revise my knowledge that I have earned so far. Overview of the program: This is a two-player game Ask for player ...
3
votes
1answer
107 views

GUI Application for counting visitors

This code was to create how many people enter the "building" so there will be someone clicking the button "count". I am still improving. Please let me know your honest opinions! ...
3
votes
2answers
72 views

Sum of proper divisors of every number up to N

I wrote a function which provides the sum of proper divisors of every number up-to N (N is a natural number) and I want to improve its performance. For example, if N = 10 then the output is: ...
3
votes
2answers
47 views

Sum array values based on conditions in other arrays

I have the following code that sums the values in wgt_dif (a numpy array) if certain conditions in two other ...
-1
votes
0answers
15 views

Is the tree a binary search tree? [on hold]

I am trying to solve a HackerRank binary search tree problem, but I can't pass all of the test cases. I need to return true if the tree is a binary search tree, otherwise, I need to return false. Can ...
5
votes
1answer
31 views

Creating ICS calendar events from JSON-like file

the purpose of this code is to take a Taskwarrior (it's a todo list application) server file that is mostly JSON and create unique ICS calendar events. The logic mostly works: I still see some ...
5
votes
0answers
49 views

Starting MD5 hash like Pi

I found a problem on here that ask to find an MD5 hash whose hexdigits starts like decimal digits of Pi. Is there a faster program or method to solve this than my program? This uses brute force search....
4
votes
2answers
96 views

BMI Calculator using Python 3

I am creating a simple BMI Calculator to check if the user is overweight or not. I am not sure how much improvement I need but I do appreciate any comments as to whether the coding is inconsistent. <...
0
votes
0answers
17 views

Team Roster. Manages Player names, phone numbers, and jersey numbers [closed]

Note: This is written using Python 3.+ I am having issues with my add function repeating the prompts to the user repeatedly. Not sure if it is doing it for removing or editing new players, but I ...
2
votes
1answer
36 views

Union and intersection of two arrays

Problem: Write an algorithm, to find the union and intersection sorted in ascending order, between the elements of two arrays Input Format The first line contains an integer, n1 , ...
2
votes
1answer
40 views

Find the longest sequence

Problem: Find the longest sequence consisting only of 0's, and the longest sequence consisting only of 1's? Solution: ...
5
votes
2answers
598 views

Number guess game program in python 3

I started learning Python just yesterday, and so I am aware of my lack of knowledge regarding the language. Below is a program I wrote to simulate a guessing game. I ended up creating a lot of ad hoc ...
2
votes
0answers
11 views

Skiena's DFS on unweighted graphs, in Python 3, with adjacency-list implementation

In the Algorithm Design Manual (2nd ed) pp 172 - 173, Skiena writes: As algorithm design paradigms go, a depth-first search isn't particularly intimidating. It is surprisingly subtle, however ...
3
votes
2answers
54 views

Nested for-loop to create list of lists - Python

I have posted the below also at stackoverflow in this thread, but a poster there recommended I post this here. Thanks for any suggestions. I have the below code, and as someone new to Python, I was ...
-1
votes
0answers
16 views

Find pairs in an array such that a%b = k , where k is a given integer [closed]

I have gone through an almost similar topic in Stackoverflow and after having tried to understand the solution (Find pairs in an array such that a%b = k , where k is a given integer). I have tried my ...
4
votes
0answers
58 views

Finding the length of the longest run in a very long generated sequence

So I am trying to calculate the longest run of True's in a boolean sequence in Python. The sequence is very long (>10^10) and so it's not possible to generate it in ...
1
vote
1answer
47 views

Demonstration of processing a queue of no-op threads

I am creating a script, that will SSH to several hosts, get stuff, parse it and return. Because I wait for server response, I'm using threading. Real script is ...
2
votes
1answer
37 views

Pattern matching (like regex)

This is a much more basic implementation of Regular Expressions (Python docs). Do note that core functionality is missing and the functions aren't completely fool-proof, but it does a good job of ...
2
votes
0answers
21 views

Suspending and resuming threads for Azure bus service

I am new to thread programming in python. I am trying to read message from azure service bus, the message may or may not be present in the queue. So this is the logic I come up with ...
11
votes
2answers
1k views

Baconian Cipher Python Implementation

I have been trying to implement various substitution ciphers in python. I implemented the Baconian cipher using a dictionary in which the plaintext letters are keys and the ciphertext letters are the ...
5
votes
1answer
57 views

News site scraping

I'm developing scrapy project for scraping news from sites and saving them to Google Sheets. Source repository is here. I want to ask about my class that must be ...
3
votes
0answers
19 views

aiohttp resources container

I want to simplify aiohttp routes/resources configuration (see this paragraphs). For this task I have written this _resources.py ...
2
votes
0answers
37 views

Count lines with more the X dots on it

I have Python a Algorithm class with a calculate method that takes the list of tuples where every tuple have 2 integers (...
3
votes
1answer
36 views

Find line of best fit

This is an update of Test thousands of combinations quickly. I have a physical robot which has a function, turn(degrees). For different robots, there will be small differences in the accuracy of the ...
4
votes
1answer
86 views

Substitution Cipher in Python 3

I am fairly new to Python 3, and I was challenged to make a substitution cipher. I came up with a very bad way to do it, but I can't think of a better way to do it. ...
6
votes
1answer
50 views

My lru_cache implementation

This code is intended to function exactly like functools.lru_cache. Is there anything I could improve in design, implementation, style, or any other area? (Python ...
4
votes
2answers
45 views

Modifying list while iterating during Breadth-first search

I am writing a function for implementing breadth-first search over a no. of nodes in a directed graph. The nodes are all numbers from 1-100. This is my implementation: ...
3
votes
1answer
72 views

Test thousands of combinations quickly

I have a physical robot which has a function, turn(degrees). For different robots, there will be small differences in the accuracy of the turn. I have fine turning variables, ...
2
votes
0answers
32 views

REST backend app script for doing CRUD transactions

As a side project, I am working on Tiddly which is a simple Python(Flask) based app for a generic REST backend that could be used for CRUD transactions on any kind of database (using ...
2
votes
1answer
41 views

My game of life implementation

I'm looking for comments on both the micro (individual lines of code) and macro (overall design) scale. My input/output format is a single string, with newlines delimiting rows and ...
1
vote
1answer
93 views

Speed up performance of nested for loops to get all related format of all Authors' Books

This works but is very slow. I have an Author table that foreign keys to all books by that author. Each book has a variety of formats it can appear in (html, pdf, etc), which its linked to by its ...
13
votes
2answers
202 views

Split mp3 of album into individual tracks

Recently, I've been transferring some of my old vinyl records to MP3 files. One of the things I did to make some progress was to automate things, so I initially set things up so that it would record ...
5
votes
3answers
110 views

Rock Paper Scissors in Python

I'm a beginner in Python and I've just finished a Rock, Paper, Scissors simulator in Python. It asks the user to enter paper, rock, or scissors and the program will generate a random number which will ...
12
votes
2answers
300 views

Counting density of Python code

I created a tool to examine Python 3 source code. It measures the density of program. More info in docstring (to not reinvent the wheel). What could be done to increase its usability? Any edge cases ...
5
votes
1answer
58 views

Recommended improvements on beginner Linked List

I know this implementation is very bare-bones, but are there any improvements I can make to it? (E.g. more pythonic, style, speed, comments). I was considering using ...
5
votes
1answer
41 views

Basic request script

I've just recently started running some wargames (Natas, OverTheWire) and thought I'd implement some of my scripting experience to solve them instead of doing it manually (though I did that first). I'...
7
votes
3answers
108 views

Piling Up with Python

This is my solution for a Hackerrank problem. The problem was: There is a horizontal row of cubes. The length of each cube is given. You need to create a new vertical pile of cubes. The new pile ...
4
votes
1answer
76 views

Degrees of Wikipedia

Here is my attempt on implementing "Degrees of Wikipedia" (much faster version can be seen at degreesofwikipedia.com.It's basically an algorithm which tries to connect two unrelated Wikipedia pages by ...