8
votes
1answer
260 views

D&D Monster Organiser

I've made a python script to properly organise D&D monster stats in a directory. The script brings up the stats as instance variables of a Monster (class) instance. For those unfamiliar with the ...
6
votes
2answers
234 views

Python terminal animation, better way than this?

Is there a better way of doing this terminal animation without having a load of if ... elif ...? import sys, time count = 100 i = 0 num = 0 def animation(): global num if num == 0: ...
5
votes
1answer
144 views

A* search algorithm: open set and heap

I'm working on an A* search algorithm implemantion and this is what I came up with for the open list: from heapq import heappush, heappop class OpenList(set): ''' This uses a heap for fast ...
3
votes
3answers
157 views

Advice on program which calculates scores for predictions of Football scores

I am writing a program which calculates the scores for participants of a small "Football Score Prediction" game. rules are: if the match result(win/loss/draw) is predicted correctly: 1 point if the ...
3
votes
3answers
125 views

How can I clean up this python code?

I am very new to programming and this is my first functional code. It works fine but I'm sure that I could use a lot of optimization. If you see any blunders or would be able to help condense the ...
3
votes
1answer
112 views

Die Roller for command line

I've written a die roller which can be run from the command line. It currently exists as three files, but I'll say later why I'd like to make it four. The files are as follows: die.py: Defines the ...
3
votes
4answers
605 views

Help me improve my style in Python: Comparing 2 csv files

Here's the exercise in brief: Consider the following file: Code: before.csv A; ; B; B; A; H; C; ; D; D; C; G; E; D; F; F; E; H; G; D; ; H; G; ; And a modified version of the ...
3
votes
2answers
86 views

improve the design of class “accuracy” in Python

I am learning about the class and methods in Python. The class Accuracy is a class of several (13 in total) statistic values between a reference polygon and one or more segmented polygons based on ...
3
votes
1answer
67 views

Python Optimizing/Speeding up the retrieval of values in a large string

I have a string containing around 1 million sets of float/int coords, i.e.: '5.06433685685, 0.32574574576, 2.3467345584, 1,,,' They are all in one large string and only the first 3 values are ...
3
votes
1answer
97 views

How can I improve this python script that counts the number of days worked for all commiters to a git repo?

I wrote this script to collect evidence of the number of days worked for the purpose of claiming some government tax credits. I'm looking for some ways to clean it up, I'm especially wondering if ...
2
votes
1answer
97 views

What steps to turn python code into python zen code

My python code is ugly and I'm having difficulty improving it. What kind of steps could be done here to make it. This is an example function that comes from time to time and I can't seem to have a ...
2
votes
1answer
25 views

Global variables in python, bottle microframework

I'm sort of at a loss for what to do with webapps and whether what I'm doing is actually allowed or not. Here is a sample of the type of thing i'm doing at the moment. I need a list that is accessible ...
2
votes
1answer
71 views

Python: improve in elegant way (code saving) a function in order to avoid several statements

I wrote this function to read Las file and save a shapefile. The function creates a shapefile with 8 fields. What I wish insert a parse element in the function in order to select the fields I wish to ...
1
vote
3answers
93 views

Could I possibly shorten / clean this up

I'm new to Python, and I'm wondering how I could possibly shorten / clean this up? def userAnswer(letters): print("Can you make a word from these letters? "+str(letters)+" :") x = ...
1
vote
2answers
64 views

Looking for Python code review of database abstraction class

I'd be very thankful if some Python masters would take a look over the following class and review the code. There is no bug(not as far as I know anyway), the code is working as intended. But, since ...

1 2
15 30 50 per page