Tagged Questions
Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.
2
votes
1answer
43 views
Convert custom format to XML Template
I have just finished writing a simple Python3 program which converts a custom input file (or multiple files within the same folder) to an XML template.
It works as it is, but I think that I somehow ...
2
votes
1answer
42 views
A phone troubleshooting program
The code should ask the user multiple solutions and find the problem with the users phone. The program should be efficient as possible and have a possible of 10 outcomes. I would like some tips on how ...
2
votes
0answers
24 views
Execute coroutines in pool
I want to run all the coroutines from the list in a pool of constant size and would like to ask if this is the right way how to achieve it. Is there any built in solution for this problem? I have not ...
3
votes
1answer
26 views
Python Weighted Object Picker
I've designed a class ObjectPicker that can be given objects and weights. Objects can be picked randomly out of the ...
5
votes
3answers
158 views
My first finished Python program: a deck of cards
I've recently started learning how to code in Python, and have even more recently learned the basics of object-oriented programming. Feeling inspired, I started on a program that would generate random ...
-2
votes
0answers
18 views
Can anyone tell me why this python code works on my Linux machine but not my Windows machine? [closed]
I'm new to programming and I have started learning Python. I am trying to write a small script that downloads .exe files from the web. The code seems to work on my Fedora 23 machine (running python ...
4
votes
2answers
41 views
Storing disassembled data in a structured way
I want to store the information returned by the dis function of the dis module in a structured way, using a dict, associating the mnemonics of each code of a line to the correspondent line number.
...
0
votes
0answers
20 views
Web Crawler with Python and the asnyncio library
I am trying to experiment with Python 3.5 async/await and the whole asyncio library. I tried ...
-2
votes
0answers
16 views
Outputting all reasons for rejection in Python [closed]
This is a basic question but I would like some help on this. I am trying to write a program that checks the dimension of an object and either accepts or rejects it. The issue is that I need to output ...
3
votes
2answers
51 views
Python Caesar Cipher
I am a student doing their AS Computing course and I have created a piece of code in which a message can be typed and then scrambled by moving letters along the alphabet. I was wondering if anyone ...
26
votes
3answers
1k views
Bush Wanderer - code intended for teaching
I am teaching computing to an AS class and this was their assignment:
Bush Wanderer
Task 1
Create a 5x5 grid of hashes(#) where the player is an ...
2
votes
0answers
34 views
Execute commands over Telnet, logging to a file
I have made some code that will login to a device and send all your additional commands. It also logs the commands and the returned values to a file on the local system.
Hope somebody can tell me if ...
8
votes
2answers
775 views
Skill creation in a python text based RPG
I am in the process of creating a text-based RPG for the purpose of learning more about OOP in Python. Right now things are going well, but I'm facing a problem that I don't exactly can find a good ...
3
votes
2answers
41 views
Constraining stdin in Python, v2.0
Rags, again.
This is the rewrite of Read stdin like a dictator.
From that post:
All too often I find myself wanting to allow only a certain list of characters to be written to stdin, and only ...
7
votes
1answer
92 views
+50
Fuzzy / approximate text matching program in Python
I'm trying to build a program that will find approximate text matches between two texts. Basically, I'd like to find a way of identifying quotations, so that when an author quotes, say, the King James ...
3
votes
1answer
27 views
GPSD socket connection and decoding JSON into Python dictionaries
GPS3 is a python 2.7-3.5 interface to GPSD.
I've stripped back everything to two classes.
...
2
votes
0answers
12 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
43 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
2answers
91 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
669 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
61 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
602 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
55 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
29 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:
...
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
104 views
2
votes
1answer
181 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
21 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 ...
5
votes
1answer
45 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
215 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
403 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
28 views
Decorating a timeout 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
51 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
22 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
64 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
80 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
45 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
30 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
66 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
55 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
78 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
75 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
21 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
39 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
85 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
83 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 ...
54
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
50 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' ...