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

learn more… | top users | synonyms

3
votes
1answer
16 views

Script for saving top wallpapers from wallbase.cc into a directory

I am newish to Python and I am looking for some extra eyes on a script I wrote. I wrote this script to learn more about web-scraping and using requests and Beautiful Soup. I use it to connect to the ...
3
votes
0answers
18 views

Personal Project for managing Bookmarks - View Part

The code is the view part of my bookmarker - project for managing bookmarks by categories. It uses Python 3.4/Django 1.6. I have also included models.py for reference. The code does the following ...
1
vote
2answers
274 views

The efficiency of looping over nested dictionaries in Python

How to make the following code more efficient? ...
3
votes
2answers
115 views

How to organize a paint cost calculator using functions?

This is the task I was given after completing my program. I don't have a clue what procedures and functions are to be honest. Therefore I have no clue on how to break down my program into different ...
4
votes
3answers
115 views

Second try at a Python game

I've posted this some time ago. Here is the new version that I made based on all the comments that were made. Another look and TIPs would be much appreciated, especially on: Getting rid of the ...
1
vote
3answers
69 views

How could I make my simple Python maze game better?

The program is running fine but I was just wondering whether there was anything I could do to make it more user friendly or efficient. Please note that I have only been programming for a couple of ...
7
votes
1answer
125 views

Tapes, Trees, Trunks & Tallies

I've written these two command-line tools to be used to facilitate forestry surveys. For a little background, the idea here is that often a landowner needs to know precisely how much wood is coming ...
1
vote
1answer
35 views

Making a list from user input - follow-up

I have made the changes that people have suggested from my previous question. I want to try and make it even tidier if possible. What can I change to make it more optimized? My ...
3
votes
1answer
48 views

Making a list from user input

I have wrote a program that lets the user open up there text file that would look something like this: 1 2 3 4 5 6 It would then let the user enter a name for ...
1
vote
0answers
52 views

Adding, deleting elements as per autocomplete results

I am working on a bookmarker project for replacing storage of bookmarks in webbrowser. It will be storing bookmarks as per categories in a database. I have written some jQuery for the WIP search page. ...
13
votes
2answers
244 views

First try at a Python game

I've started coding about 3 weeks ago, just for fun and maybe practical uses later. My GF dared me to make a PGM that would replace this dice game where you roll two dice, one with body parts and one ...
5
votes
2answers
74 views

Social Media Hashtag Splitting

I decided to try out Python (3.x) two or so weeks ago, and this is my first real script using it. The program I've written below is slow, clunky, inefficient, inaccurate, and probably poorly coded! ...
0
votes
1answer
55 views

Is this Pygame projectile code efficient?

Just wanted a few opinions on whether this game's code is efficient, from looking at it, it does look a bit all over the place but I just don't know how to 'tidy' it up to say so. Would love to hear ...
4
votes
3answers
76 views

Calculating the point of intersection of two parabolas

I recently wrote a function to calculate the intersection point(s) of two parabolas. Working it out on paper was a nightmare, but I eventually did it (I think it's correct), and ended up with: \$ x ...
2
votes
1answer
37 views

Python script to find large folders

I wrote this script a few days ago to find all files which were taking up over a certain threshold of memory on the hard drive. A hard drive on one of my computers had just 6 GB left, so I needed to ...
4
votes
2answers
116 views

Python implementation of the Ramer-Douglas-Peucker Algorithm

I recently implemented the RDP polygon approximation algorithm in Python and I'm skeptical of whether or not I implemented it correctly of with the greatest efficiency. The algorithm runs in around ...
3
votes
2answers
84 views

Python Barcode Generator v2

This is a complete rewrite of the code posted for review in this question. The question is identical. ...
2
votes
3answers
70 views

How can I optimize this hash string function?

I'm writing a function which gets two strings and a number k as an input, and outputs a string with length k which is present in ...
5
votes
2answers
114 views

Class Vector with Python 3

Here is a class vector in python 3, for n-dimmensional vectors. Please suggest ways to improve the code as well as fix bugs and errors. The only rule is not using: numpy, sympy, scipy and so on. Only ...
2
votes
3answers
122 views

Python Barcode Generator

I was asked to provide some example code for a job interview and didn't have anything to offer, so I wrote the following function. A barcode generator may seem a bit basic, but there's some logic ...
6
votes
1answer
193 views

Python Back-Up Script

I wrote this script to backup some important files. It backs up the files to a local folder as well as to an external hard drive. It creates a new subdirectory which has its name constructed with ...
3
votes
1answer
111 views

ISBN Number Check

I’ve recently coded a way of checking a 10-digit ISBN. I was wondering if the code works to check the numbers, and if there are any flaws in my code. ...
3
votes
2answers
129 views

Generating a random string of characters and symbols

After coding this, I was wondering if there are any ways in which I can improve upon it. It generates a random string of characters and symbols the same length as what is entered by the user. It uses ...
4
votes
2answers
79 views

Measuring Execution Times

I was wondering which time.time() of from datetime import timedelta was the quickest and best way to find how long a programme ...
5
votes
1answer
46 views

Does this code actually give a valid representation of how quick a system is?

So I wrote this code a while ago as a way of seeing how many times it could compute a simple sum in a second (one tick). I was wondering if this gives me valid results or is in fact giving me bogus ...
6
votes
4answers
666 views

Are there any bugs or ways to make my divisor code better?

After coding my divisor code which I did as a practice for my GCSE stuff which I have to take soon, I have decided to ask the community if there are any bugs or ways I can improve my code. ...
15
votes
2answers
169 views

We'll be counting stars

Lately, I've been, I've been losing sleep Dreaming about the things that we could be But baby, I've been, I've been praying hard, Said, no more counting dollars We'll be counting stars, yeah we'll be ...
3
votes
1answer
78 views
5
votes
2answers
89 views

Geometry table for use in regexes

I have been teaching myself Python 3. I watched a video on YouTube entitled "stop writing classes". The Gtable class doesn't even have an init function, so I can't help but wonder if I should have ...
3
votes
1answer
43 views

Write and control Perlin noise for 1D

I'm reading this tutorial and it's the first time I try something this new. Here is my attempt: ...
5
votes
1answer
109 views

ASN.1 BER Encoding and Decoding

I have a project (ldaplib) I am working on that needs to do ASN1-BER decoding and encoding. The function I have for the decoding portion is slightly more complex but neither are all that complicated. ...
5
votes
1answer
91 views

Segment tree in Python3

I've implemented a Segment Tree in Python3: ...
5
votes
1answer
48 views

Determining the least-accurately known physical constants

So, I thought I'd do this using scipy.constants: ...
6
votes
2answers
83 views

Searching for files in a specified directory

I am currently writing a program that allows me to search for files in a user-specified directory. My current code is as follows: ...
4
votes
1answer
86 views

Installing Mods With Python (v 2.0)

My original code is here. I made some changes to it based on your suggestions, but then I lost my flash drive and had to redo it. I have a suspicion that my second version was better than this one, so ...
4
votes
0answers
85 views

Ways of speeding up this python implementation of SAT (Separating axis theorem)

A project I was working on required the usage of the Separating Axis Theorem to detect collisions between two convex polygons in real time. So I implemented a basic class (...
7
votes
2answers
114 views

Python Port Scanner 2.1

I made lots of changes to the script presented in my previous question. I was tempted to edit that one with the new code, but it would invalidate @200_success's helpful answer. It was also ...
3
votes
1answer
72 views

Python Port Scanner 2.0

A few months ago I put up a port scanner for review. Now, I've updated it with some new Python knowledge and integraing the feedback I got. Some things I specifically think might be wrong with it or ...
7
votes
2answers
78 views

Python script to test music sight reading

I decided to write a program to test music theory, and, while it would've been much easier for me to make it elegant and perfect in Java, I thought I'd take the opportunity to get more familiar with ...
1
vote
1answer
214 views

Bank ATM program in Python

For homework, I have to code a program in Python that effectively simulates a bank ATM. ...
3
votes
1answer
61 views

Should I put python3 argparse filetype objects in a contextlib stack?

I just read the Lib/argparse.py code (class FileType) on http://hg.python.org/cpython/file/default/Lib/argparse.py. File objects are opened without the with statement. For safe file opening/closing, ...
7
votes
2answers
252 views

Wrapping my head around generators

I am going on with refactoring my code base while migrating from Python 2 to Python 3. I am using generators to make reusable components this time as I am more comfortable with them this time then ...
5
votes
1answer
108 views

Increasing readability of maximum path sum algorithm

I had written a solution for Project Euler problem 18 in Python 3. It is good in its efficiency but the problem is the readability and I think reuse. The algorithm used is that at every iteration ...
1
vote
1answer
67 views

Calculator for Mass

I've been trying to create a calculator to find mass using any and all known equations, the program will also return the steps used to find mass so the user can 'check their work' on physics ...
6
votes
2answers
235 views

Pythonic way to dynamically generate Strings (or other variables)?

I've got a Python script which is meant to launch several other shell scripts with the appropriate setup and parameters. I construct the file paths from other variables so that it's easier to change ...
10
votes
4answers
538 views

Suggestions for a Dungeons and Dragons-like game

This game is similar to a Dungeons and Dragons game. How could I improve the efficiency of the program? For example, where can I add functions, records etc? This is for a school Controlled ...
0
votes
0answers
37 views

Simple OpenID server that always returns “allow”

I have an application that uses OpenID for authentication. To test that application I've come up with the following: ...
12
votes
2answers
192 views

Drink order program

I'm looking to improve my code to make it more efficient, such as shortening it but continuing to gain the same output, or to add some more complex functions into the code. ...
3
votes
1answer
63 views

Time optimization of counting shifts in insertion sort

Is there any way of counting how many shifts would it take to count shifts while doing insertion sort? This is a Hackerrank problem. Here's my solution, but it takes more than 16 seconds. ...
5
votes
2answers
504 views

Sherlock and The Beast

I have recently written the program for the Sherlock and The Beast' HackerRank challenge. That's working fine, but the problem is that it takes too much time if a big number is given as a input. I ...