Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008.
2
votes
1answer
39 views
RPi script to periodically collect data from Arduino through serial port
I'm not used to Python.
The script opens serial communications with an Arduino unit and send commands to and receives information from the Arduino. It is intended to run indefinitely until the system ...
2
votes
0answers
31 views
Basic Python Tic-Tac-Toe Game
I have just decided to get into programming as a hobby (and possibly a job in the distant future). After learning the basics of Python, I made Tic-Tac-Toe to apply what I've learned. I would ...
1
vote
1answer
37 views
Find a specific file, or find all executable files within the system path
I wrote a function to find a specific file, or all the executable files with a given name and accessing flag, and I want to make ...
6
votes
1answer
608 views
Breadth-first search on a tree in Python
The following code performs breadth first search on a mockup tree
...
1
vote
1answer
17 views
Remove non-printable characters from string in Python 3
My aim is to print bytes string lines in Python 3, but truncate each line to a maximum width so that it fits the current terminal window.
My first attempt was only ...
3
votes
1answer
52 views
Basic sorting in Python
Previously asked here.
I would like to get my code for implementation of simple sorting algorithms in idiomatic python code reviewed. I am looking for feedback on python idioms used, better ways of ...
2
votes
1answer
66 views
Implementing basic sorting in Python
I would like to get my code for implementation of simple sorting algorithms in idiomatic python code reviewed. I am looking for feedback on python idioms used, better ways of doing the same thing. I ...
-3
votes
0answers
15 views
Simple python console websocket client and tornado websocket server [closed]
https://github.com/yevhen-m/async-chat
Hey guys, who has a minute or two to review my exercise python project on websockets? I would be very grateful for that.
1
vote
0answers
6 views
Unit Tests for a Redshift Wrapper Class
I'm somewhat new to TDD and Unit Testing, but I've written a suite of unit tests to check my functionality. The basic classes ...
1
vote
2answers
41 views
GUI Caesar Cipher with model-view-controller
I created a Caesar Cipher Program in Tkinter, to help me learn the Model-View-Controller concepts and Tkinter in general. The code works, but it is a mess, and I want some help on cleaning it up, ...
5
votes
2answers
79 views
Python simple battleship game
I'm relatively new to Python, I decided to make a simple battleship game. Is there anything I should do to make it shorter, or in practice, "better"?
...
6
votes
1answer
34 views
Aligning out-of-sync subtitles
This is my 2nd program I wrote on my own, a pretty simple program consisting of two functions (those functions are not combined in any way yet though). The first function moves the display times of ...
4
votes
1answer
145 views
Simple Hangman game in Python
I recently started learning Python, and made a simple text based Hangman game. I wanted to know if there could be anything done to make the code cleaner or more efficient.
...
0
votes
0answers
10 views
Improving the performance of web scraper using BeautifulSoup
I am using python3 with Beautiful Soup to scrape web site, I also used Thread to download images, but it will spend more than 30 minutes to get all information and download relevant images, how can I ...
10
votes
4answers
122 views
n-queens puzzle in Python
I want to increase the efficiency and reduce the time complexity for the n-queen problem in n*n matrix chess. I am able to run only still (11*11) in normal time otherwise for the big number it is ...
2
votes
1answer
22 views
Redshift Load and Unload Wrapper class
We do constant traffic with our Redshift tables, and so I created a wrapper class that will allow for custom sql to be ran (or a default generic stmt), and can run a ...
2
votes
0answers
17 views
Adaptive scan of function concurrently
This function try to scan the given function in n dimensions in the given range by adaptively divide the area into n+1 points polygon (e.g. triangle in 2D; tetrahedron in 3D)
I tried to seperate the ...
2
votes
2answers
44 views
2
votes
0answers
32 views
Controlling the order of unittest.TestCases
Apparently everyone gets burned by their Python unittests not running in the order they want.
I am not in the business of telling people not to do perfectly reasonable things they want to do, so I ...
2
votes
1answer
49 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 ...
3
votes
1answer
120 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
28 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
210 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 ...
4
votes
2answers
42 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
26 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 ...
3
votes
2answers
61 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
51 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
814 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
42 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
101 views
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
35 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
45 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
93 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
691 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
63 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
608 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
111 views
2
votes
1answer
189 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
23 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
49 views
Markov chain text generation in Python
I'm willing to listen to any advice you have for improving it.
...
3
votes
2answers
25 views
Partitioning comments by date
I have a list of Comment objects comments. Each Comment has several properties, one of which ...
5
votes
3answers
235 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
30 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?
...