Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.
0
votes
0answers
2 views
Base class for the Oauth process and dance
At work we are interfacing with the Jira cloud storage for our ticket management system. I created a base class to make the process easier on the user side, and I did my best to make it re-usable and ...
1
vote
1answer
31 views
Adding items in a list
I wrote a function that adds items in a list, but my professor says to try and write it in a simpler way because he says I take too many steps. Is there any other way to write this?
...
5
votes
1answer
71 views
Team Fortress 2 item price lookup using Trade.tf developer API and Steam WebAPI
I've made a nice little Python program using the requests module using the Trade.tf Developer API and the Steam WebAPI allowing the user to look up the price of ...
5
votes
3answers
619 views
Python colour game
This is a Python program that requires the user to type the colour of the text and not the name of the colour. They have a set time limit and a scoring system. If you have any improvements or ...
3
votes
3answers
57 views
Avoiding numbness with Python Enum
First, the context:
I'm working with a student to build a web frontend for a star cluster simulation package called starlab. Typical starlab usage involves ...
20
votes
3answers
580 views
Calculate questions per day on CodeGolf.SE
I wrote a short script in Python 3 that connects to the Stack Exchange API, gets all questions on Programming Puzzles & Code Golf over the past two weeks, and determines the average number of ...
2
votes
1answer
41 views
Tic-Tac-Toe game in Python-3.x
I would really appreciate a general review of my Tic Tac Toe game in Python as I have spent a lot of time on it. Any improvements or suggestions?
...
1
vote
0answers
24 views
Start the Python interpreter with an import statement
When I'm writing Python, I wanna be able to pull up an interpreter quickly, and import what I need easily. Previously, this involved:
...
-1
votes
0answers
15 views
11
votes
4answers
1k views
Python sprinting game using strings, loops and statements
Here is my code for a sprinting game in Python. You have to tap the 'a' and 'd' keys as fast as you can to run 100 meters. Any improvements?
...
3
votes
1answer
90 views
3
votes
1answer
102 views
Encryption and decryption using alphabetic shifts
My first piece of code encrypts text by moving each letter in the string 5 letters across in the alphabet.
...
0
votes
0answers
19 views
Email a notification when detecting changes on a website - follow-up
I read through other questions here and improved the code and added a new feature. The old question can be found at: Email a notification when detecting changes on a website
The improvements that are ...
4
votes
1answer
38 views
Markov chain text generation in Python
I'm willing to listen to any advice you have for improving it.
...
3
votes
2answers
23 views
Partitioning comments by date
I have a list of Comment objects comments. Each Comment has several properties, one of which ...
5
votes
3answers
194 views
Email a notification when detecting changes on a website
The text of a website is checked in a given time period. If there are any changes a mail is sent. There is a option to show/mail the new parts in the website. What could be improved?
...
3
votes
2answers
399 views
Python exception handler to recommend package
Consider this python 3 snippet, where when an import exception is raised, a string 'e' is created that says: "No module named ' packageName'".
The goal is to simply say on exit, that the import error ...
0
votes
0answers
13 views
asynchronous web crawler python [closed]
I am writing a small crawler using python3.5. The first version I wrote worked fine but it was too slow (single thread). I googled and found some ways of speeding up things. I tried implementing ...
0
votes
0answers
10 views
Any better way to decorate a time out function?
I've picked up the timeout-function below from ActiveState's recipes for Python2 and polished it for python3.4.
Is there any leaner, less clunky way to write it?
...
5
votes
1answer
49 views
Struct in Python
I'm writing a struct class in Python and was wondering if this were a good way to write it:
...
-3
votes
1answer
20 views
Couting items problems [closed]
Hello I want to write some code in python that accomplishes the following:
Input and store number of items in a consignment. Use some validation to determine whether the parcels can be accepted or ...
3
votes
2answers
62 views
Generating simple and complex passwords
I am pretty new to Python and I would like some tips and criticism on my formatting style/code and what can be better organized. I am a bit shaky on how classes work, but I think that it can be used ...
7
votes
1answer
77 views
Checkers in Python 3
I'm writing a small checkers game in python (international rules) and I need some pointers here and there. For the moment, I am only drawing the board and checking the syntax of moves with a regex.
...
3
votes
1answer
43 views
Minimal, Low-level Telnet API
I've started Python some days ago and wrote a small Telnet implementation according to RFC 854 and RFC 5198. It is pretty low-level and sending messages directly isn't even supported. The highest ...
1
vote
1answer
29 views
An ETA plugin for hangoutsbot
This is a plugin for hangoutsbot/hangoutsbot that listens for words people say and then gives them an ETA and a link with directions.
Happy to hear about any optimisations that could be made.
...
6
votes
2answers
65 views
N-Bonnaci sequence calculator
The code calculates a n-bonnaci sequence to a certain number, based on the user's input. It then can print it to a file and/or print it to the console.
The ...
6
votes
2answers
155 views
Validating ISBNs
I'm just looking for a cleaner way. Obviously I could store a variable for some of the int parts. Personally, I think the one-liner looks better and everyone's ...
1
vote
1answer
31 views
Created a frame with a disabled button, till check button is used, then return to starting state
I've been coding Python for little over 6 months now. I am self taught and I would like to ask for some help for myself and also for others in my position who's been wondering if they're going about ...
7
votes
2answers
77 views
Calculate food company sales for the year
I am working on a Python project where a food processing company is trying to calculate its total sales for the year. Python has to read from a text file where its divided into for categories split by ...
2
votes
2answers
70 views
Python Hangman Game
This is my hangman game code for my GCSE computer science coursework. It has been submitted but I was wondering if there is anyway to improve it.
...
1
vote
0answers
17 views
Flask json rpc2.0 extension
I created a simple extension to handle JSON RPC 2.0 requests on flask
I would like some feedback regarding usage
here is an usage example:
...
2
votes
2answers
35 views
Split up an iterable into batches
I was writing a program that had a list of e-mail messages. It needed to group them into batches, with the condition that each batch must have at max 20 messages, and be maximally 50k in size (no ...
3
votes
2answers
75 views
Dynamic class instancing (with conditional parameters and methods) based on a dictionary
In a RPG game I'm developing, after building a base Weapon class, instead of having many subclasses of Weapon, I want the ...
6
votes
2answers
78 views
Dijkstra's algorithm using collections.namedtuple
I decided to try out some named tuples by implementing Dijkstra's algorithm to find the cheapest routes in a file like this (where each line represents node_a is ...
53
votes
6answers
9k views
How clean is my snow?
I just wrote a snow animation in Python. I think this is fairly clean but I have a few things that I don't like.
...
2
votes
1answer
49 views
DocsGatherer - gathering and organizing fragmented documents
This script is used for gathering fragmented documents from your computer, and organizing them by extensions.
Here is the main things my algorithm does:
Search through path(s)
Stores documents' ...
1
vote
1answer
93 views
2
votes
1answer
51 views
Skip list in Python
I've made an attempt at writing a skip list in Python. I'm using NumPy to generate geometric random variables, but since that's a bit of a heavy dependency to drag around I could easily implement that ...
3
votes
2answers
44 views
Python script converts after effects clipboard keyframe data to nuke keyframe data
This is my first 'proper' script since learning python and I'd love it if I could get some feedback on things I've done wrong / things I can improve on.
The script takes clipboard data from after ...
4
votes
3answers
84 views
Python Hash Table Implementation
I'm attempting to implement a basic hash table in Python using only lists. any tips would be appreciated (including better hash functions).
I intend this to handle collisions with separate chaining.
...
9
votes
5answers
1k views
Ackermann function
I just came across the Ackermann–Péter function a few weeks ago, found it to be very interesting, and decided to write a simple implementation of it in a favorite programming language of mine.
...
1
vote
3answers
83 views
List comprehension for reading lists of integers
As of reading the following input.txt file:
1 6 14
1 2 7
1 3 9
2 3 10
2 4 15
3 6 2
3 4 11
4 5 6
5 6 9
I wanted to make a list ...
1
vote
1answer
34 views
Mod maker (creates XML files to be used as mods)
This code add functionality to a GUI designed using PyQt. It cannot run alone, but I can provide the code. I am not asking for someone to provide criticism for every single function written here, but ...
9
votes
1answer
92 views
A convenient wrapper for Telegram Bot library
I'm working on several projects involving Telegram bots and I've decided to make a library that meets my needs. Basically, there is already a Python library for Telegram bots (...
1
vote
1answer
30 views
Writing a Counter object to a CSV-file in Python 3
In Python 3.4, a Counter object called cnt like this:
...
1
vote
0answers
30 views
Optimal use of Python 3's multiprocessing package to create Sudoku grids
I want to create Sudoku grids using Python. As it's pretty slow if I want to create a bunch of grids, I decided to use multiprocessing.
My computer has 4 virtual ...
2
votes
0answers
15 views
Speed up structured NumPy array [migrated]
NumPy arrays are great for both performance and easy use (easier slicing, indexing than lists).
I try to construct a data container out of a ...
1
vote
4answers
90 views
Updating a dict with dict values
This code works and does exactly what I want it to, but I feel that it is inelegant. It seems like there should be a way to use get() and/or setdefault(), for example. All comments and suggestions ...
1
vote
1answer
36 views
Write binary save file in Python
I'm fixed on the save file format. There are only three types of data:
long (NumPy int32 array, independent of platform)
...
2
votes
0answers
18 views
HTML Scraper for Plex downloads page
I have written a scraper in Python 3 using Beautiful Soup 4 to retrieve the latest version of Plex Media Server from https://plex.tv, and I'd like some feedback on how to improve it.
The HTML the ...