Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.

learn more… | top users | synonyms

-2
votes
0answers
10 views

Check if username is admin OR is in CSV [on hold]

I want to check if the input, which is a username, is in the CSV file, and when it is in it, I would like to login with that name: ...
-1
votes
0answers
12 views

Payment flow of stripe in a database in Django [on hold]

I have tried to integrate stripe in my Django website (and I did), and now I would like to explain the flow so that you can tell me what improvements that I must make: Verify if the email exist in ...
8
votes
1answer
45 views

WiFi adapter settings

According to the advise I got in Stack Overflow, I'm asking here. yesterday I have found that I can't use the wireless network at some spots in my house. I used another modem as a WiFi booster and I ...
2
votes
1answer
15 views

Creating a time-course dependent, correlation-based directed graph with Networkx

I have a correlation matrix containing 4 time points, each with multiple samples. Each sample is identified with a time point with its name. What I am trying to accomplish here is to create a directed ...
1
vote
1answer
43 views

Passwords storage class

I'm writing a tool, to manage our application, specifically to store passwords in encrypted view. I made a class which is based on two posts: ...
2
votes
0answers
34 views

Strawpoll fetch API in Python

As a beginner to Python with some rookie experience in building software, I decided writing an API wrapper for Strawpoll would be a good exercise in learning the language and design patterns. The ...
4
votes
1answer
5 views

Trying to use global variables for referencing directories in Python 2.5

I am writing a small utility that reads a number of print files to extract out financial data, and then build a spreadsheet populating the data in specific cells. I have it working, but it's not ...
1
vote
2answers
42 views

Using break for nested for loop

I want to apply three levels of filtering on record. rec in cname. rec is string of >2 ...
1
vote
1answer
34 views

“Flipping bits” Python implementation

Problem Statement You will be given a list of 32 bits unsigned integers. You are required to output the list of the unsigned integers you get by flipping bits in its binary representation (i.e. ...
0
votes
2answers
39 views

How should I arrange my imports?

I inherited a project that has many imports. Is there any way to refactor it so that we don't have this many imports? ...
4
votes
1answer
34 views

“Lonely Integer” Python implementation

Problem Statement There are N integers in an array A. All but one integer occur in pairs. Your task is to find the number that occurs only once. Input Format The first line of the input ...
10
votes
3answers
69 views

Producing and comparing maximum sub array sum algorithms

This is an exercise in implementing the maximum sub-array sum problem. It asks for several solutions of complexity: \$O(n)\$ \$O(n \log n)\$ \$O(n^2)\$ \$O(n^3)\$ For an additional challenge I ...
6
votes
2answers
133 views

Factoring Polynomials Completely

I am relativly new to Python and I decided to try to write code that would factor any polynomial using the Rational Root Theorem and synthetic division. I have two questions. Is there any way I can ...
2
votes
2answers
19 views

SQLite DB Check and Update Script

My script looks for handshake files in an input folder to determine whether certain processes have completed. If it finds them, it will update the database with the current time stamp. Things I am ...
1
vote
2answers
19 views

Ceasar Cipher by Word Length V.2

Here is an updated version of my Caesar Cipher script. I am looking for ways to improve it, make it more succinct, and expand it's features. I would eventually like to add text import and export ...
2
votes
3answers
35 views

Fairly Simple Hangman in Python

This is my take on a simple hangman game, which is played from command prompt. ...
2
votes
2answers
33 views

ML Retraining project

Tear me to shreds. The class RandomForestRetrainer will be used to retrain a machine learning algorithm. It has functionality for taking in a directory containing malware or benignware files and ...
-3
votes
0answers
24 views

Trying to use global variables for referencing directories in Python 2.5 [on hold]

I am writing a small utility that reads a number of print files to extract out financial data, and then build a spreadsheet populating the data in specific cells. I have it working, but it's not ...
1
vote
4answers
273 views

Counting sort in Python

I wrote the following function to implement counting sort: ...
5
votes
3answers
52 views

Python OOP shopping cart

I am a new Pythoner, and don't have good knowledge of OOP. I completed the following task, but I feel the code is not good. I welcome recommendations to improve the code. You need to create the ...
3
votes
1answer
39 views

English Checkers - Python 2.7

I've written this English checkers game. Meanwhile, it's a human vs. human game, although it is easily extensible to a game between other players (such as a computer one). I hope it is not too long ...
5
votes
1answer
40 views

Process text file of fulltext articles from news publications

I'm relatively new to programming and have started writing some code for work. This script is something I wrote that I'd like to have someone comment on. Am I doing anything silly, stupid or totally ...
1
vote
2answers
53 views

Pangrams python implementation

Given Roy wanted to increase his typing speed for programming contests. So, his friend advised him to type the sentence "The quick brown fox jumps over the lazy dog" repeatedly, because it is a ...
-1
votes
0answers
15 views

Python shipping charge program [on hold]

Alright beginner who's teacher has assigned him a program that requires him to make a user ask the weight of an item and then displays shipping charges. my problem is this I'm not sure how to include ...
2
votes
2answers
41 views

Project Euler #18: Maximum path sum I

Problem I want to receive advice on my code, which takes 0.012 seconds. ...
4
votes
2answers
35 views

Raising an error if a variable is not created during class initalization

I would like to properly raise an error if self._header was not created when I initialize a NewFile object. This is working ...
2
votes
2answers
80 views

Roll the die… play again?

Is there a way to write this code more efficiently so that it is easier to read, maybe using loops and lists? ...
1
vote
1answer
31 views

Stock quote checking script

I know that this code would look a lot better if I made it so that checking the current prices against the open prices were in a function. This would avoid rewriting it for every stock I want to ...
-2
votes
1answer
42 views

Caesar cipher using the word length as key [on hold]

Here is a code I'm working on that alters a individual letters.Each letter is pumped up x amount of letters. This alteration is dependent on the length of the word. So for instance "hi" becomes "jk", ...
3
votes
1answer
87 views

Project Euler #14: Longest Collatz sequence

Problem : source Which starting number, under one million, produces the longest chain? n → n/2 (n is even) n → 3n + 1 (n is odd) I want to receive advice on my code. It is too slow... It ...
1
vote
1answer
33 views

Project Euler #12: Highly divisible triangular number

I want to receive advice on my code. It is too slow... The problem I am trying to solve is: What is the value of the first triangle number to have over five hundred divisors? ...
4
votes
4answers
543 views

Plus Minus in Python

You're given an array containing integer values. You need to print the fraction of count of positive numbers, negative numbers and zeroes to the total numbers. Print the value of the fractions ...
5
votes
2answers
54 views

Printing octo-thorpes

Given a number, for example, \$6\$, this Python function should print hashes in the following format: # ## ### #### ##### ###### This is the ...
6
votes
2answers
91 views

Random Word Splitter

I wrote a word splitting function. It splits a word into random characters. For example if input is 'runtime' one of each below output possible: ...
5
votes
0answers
29 views

Automate branch merging with git

I wanted to learn how to use python to replace bash, and found this old post from 2008 or 2009. The output of git has changed a bit, though, so I decided to remake it. I also decided to try out ...
2
votes
3answers
145 views

Get count of digits of a number that divide the number

So, here's a program in python to get the count of digits that divide the number. If you give the program a list like [24,10245], you get an output of: ...
4
votes
2answers
80 views

Finding all legal bishop moves

I am trying to create a two player Chess game. To do this I want to generate a list of legal moves. I am having trouble with the brevity of the code to generate the moves for the rooks and bishops. ...
2
votes
1answer
32 views

Dead-end filling maze solver in Python

I was reading Wikipedia about maze-algorithms, and I decided to write my own maze-solver. It uses dead-end-filling as it seemed simple to implement (it seemed, I said). The code I wrote is pretty ...
1
vote
3answers
41 views

Diagonal difference

Given You are given a square matrix of size N×N. Calculate the absolute difference of the sums across the two main diagonals. Input Format The first line contains a single integer N. The ...
2
votes
2answers
58 views

Excluding an element from a dictionary

I was asked to change code that I maintain (but didn't write) for a learning management system that previously listed an examed course both under examed courses and other courses and now my task was ...
-4
votes
0answers
39 views

Hailstone sequence using nested while loops [on hold]

I'm writing a program that allows the user to input a range of numbers, and then the program will preform a hailstone sequence of each number in the range and will then print the number with the ...
9
votes
4answers
532 views

Optimizing Project Euler Solution #12

Just to reiterate my prev. post, as I think it helps structure my weaknesses. Coding methodology: Is the algorithm I used feasible or mostly correct? If not, how do I correct it and why won't it ...
11
votes
1answer
256 views

Cactus Reborn - A game engine for text-based adventure games

I'm currently working on reincarnation of the Cactus project, Cactus Reborn, and I've gotten the basic implementation so far. At this point, you can create simple, playable games. There are currently ...
5
votes
1answer
63 views

Notifying if a plane has been found

The object is to notify if a plane was found or not. The aircraft_identifier variable is a must. cpl_id and ...
0
votes
1answer
33 views

Snake game with graphics and classes [on hold]

I just finished my first PyGame project here (GitHub), and would like to get some reviews on the code. It's multiple files of code and few images for graphics, so I figured it's easier if I just link ...
-2
votes
0answers
30 views

Income growth/retirement feat. loop function [closed]

"In this first problem, we are just going to consider how your nest egg grows due to monthly contributions and careful investments." Question asks to "Write a program to calculate your retirement ...
3
votes
2answers
190 views

“Guess number” game in Python

What could I improve on this code? ...
-1
votes
0answers
23 views

Python :SPOJ problem (Prime generator) working on my pc but not on the website [closed]

I am solving a problem in SPOJ (Prime generator) I made the program it works perfectly fine on my computer but doesn't seem to work on the SPOJ and I absolutely don't know why I even double checked ...
3
votes
1answer
42 views

Multiplying over a matrix

The below code is a solution I put together for the Project Euler #11 question which asked to find the largest product of 4 numbers of any direction in a matrix (horiz, vertic, and diag all ...
6
votes
2answers
101 views

Typing training with GUI in Python

This script allows you to practice your typing skills, as soon as you finish typing a new word appears for a non-stop typing experience. The code has in memory the top 100 words as per the Pareto ...