Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
1
vote
0answers
10 views
Samba Access Wrapper V2
Follow up on this post.
I created a Python module to access Samba shares some time ago, using Mike Teos' SMB module as some kind of a base to it. It is mostly a wrapper, but as I said, I wrote it ...
0
votes
0answers
29 views
Decreasing lines used in a python program
I've been trying to write a function that takes a list of numpy arrays, applies an operation to each individual numpy array, and then returns a list of processed numpy arrays, but it didn't work out ...
0
votes
2answers
45 views
Random Walk simulator seems slow, are there ways to optimize my code?
I'm trying to write a short random walk simulator in which an agent has a 50% chance on each "round" to either move toward x or back to its initial position. If the agent is already at its initial ...
4
votes
1answer
30 views
Calendar made with tkinter
I made a calendar that displays text documents according to month. Thankfully it works, although I could really use some help how to make it more better looking and efficient. I'm new to programming ...
6
votes
4answers
726 views
Python, JavaScript, PHP, HTML: Unbeatable Tic Tac Toe
At first, I created an unbeatable Tic-Tac-Toe in Python. However, I wanted a better interface, so I used a PHP backend that runs the script and a simple JavaScript that sends user commands to the ...
-4
votes
0answers
15 views
Very simple pong game in Pygame [on hold]
How can I improve my code?
I have been coding in python for a while and have just started pygame. I decide to make a pong/squash-esque thing. It took me about two hours. It is alright but it can ...
2
votes
1answer
12 views
Auto registering class registry
I built this auto registering registry to look into a package and import all modules and register any classes that are a subclass of a base class. I use it as a registry for a model's choices in ...
3
votes
1answer
47 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 ...
1
vote
1answer
55 views
Python implementation of Netcat, new design
I've made a simple netcat in Python and would appreciate any advice/opinions of how I've implemented it.
test.py:
...
-4
votes
0answers
18 views
Maths Test Database Programme [on hold]
I am writing a code for my coursework. It worked fine, however, instead of printing 10 questions, it would print 11 - so I changed the loop number from 10 to 9. It does ask 10 questions now, but no ...
2
votes
0answers
40 views
Find all distinct subsets that sum to a given number
The function wants to achieve to find all distinct subsets that sum up to an given number.
...
2
votes
1answer
63 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 ...
0
votes
2answers
31 views
1
vote
1answer
26 views
Quickly find percentile with high precision
I need to find the percentile where a list of values is higher than a threshold. I am doing this in the context of optimization, so it important that the answer is precise. I am also trying to ...
0
votes
1answer
37 views
Caesar Cipher Test
I've been studying computer science for around two school terms now. Currently, I'm making a Caesar Cipher program as a base for my examination, this is so that I can use the 15 hours to either add, ...
5
votes
1answer
107 views
Cyther: The Cross Platform Cython/Python Compiler
I am currently writing a Python library (soon to be published)that automatically compiles a Cython/Python file to pure -O3 C, without the user having to do anything ...
-1
votes
1answer
24 views
-3
votes
0answers
34 views
My python code is overly complicated. What's a better way of doing this? [on hold]
ok so my code is basically a character sheet. I run the module and basically type whatever I want to see. Like this:
...
1
vote
2answers
38 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, ...
3
votes
1answer
48 views
Python implementation of netcat
I'm trying to write a simple python script that acts like the nc program (netcat). I've got it working on OSX (the client that is) by testing against a netcat server, but I'm unsure about the way I've ...
4
votes
2answers
81 views
Simple text adventure game
I've decided to make a text adventure game but I feel that the code I have now is annoying, and as I get farther, it will make it hard to read. Is this a correct assumption? Please tell me what I'm ...
1
vote
0answers
21 views
Implementing Flask create_app function with SqlAlchemy
I have a simple Flask app that realises rest-api with SQLAlchemy. I have written this create_app function:
views.py
...
5
votes
2answers
74 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"?
...
3
votes
1answer
65 views
Arithmetic quiz with class database and score analysis
I have done this quiz project and I have tried as hard as I could when I was writing to make it user friendly to read. Could you help me on improving and making it more user friendly please.
...
-3
votes
0answers
11 views
My code returns a value for the last iteration date, and not for the entire iteration [closed]
My function reads a CSV file consisting of dates with times and sentiments(positive, negative and neutral). It returns three dictionaries (positive_dict, ...
5
votes
2answers
77 views
Coloring a string in a terminal
I have this code which makes it easy to color a string in terminal but it is looking really repetitive. Is there a more idiomatic way of writing this? Also is there a functional way of doing this more ...
3
votes
0answers
11 views
Kivy language code of my Vehicle Details app
So I've written my first android app in kivy.
This app takes a Vehicle License Number as input from the user and submits it to a sites and shows the results from the site.
The complete Source Code ...
6
votes
1answer
33 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 ...
13
votes
2answers
1k views
Python backend interview: task management system for workers
I've recently applied to a backend position and I was asked to complete a take-home interview question. I thought the question was rather simple and I completed in about an hour although I was told it ...
-2
votes
0answers
23 views
Stacked bar charts using python matplotlib for positive and negative values [closed]
I am trying to plot a stacked bar chart with python Matplotlib and I have positive and negative values that I want to draw. I have had a look at other posts talking about how to plot stacked bar ...
4
votes
1answer
140 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.
...
3
votes
1answer
28 views
Putting a matrix from a text file into a list
I'm trying to read a text file with matrix and put it in a list, but I am using two loops here and I want my function to be faster.
...
1
vote
1answer
46 views
Charging battery animation over time
I have the following method that is working perfectly. Main problem I see is that I think it can be done just in one line, but I don't know how:
...
10
votes
4answers
118 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 ...
4
votes
1answer
117 views
Finding the longest path, avoiding obstacles in a 2D plane
The Scenario
You are given a matrix of size m x n (width x height) with m*n spots where there are a few obstacles. Spots with obstacles are marked as 1, and those without are marked as 0. You can ...
3
votes
2answers
151 views
“Guess my Number” game in Python (2.7.9)
First time posting to Code Review. Just looking to get some advice on how I can write better code.
I found the following exercise for a "Guess my Number" game on DaniWeb, but the linked source code ...
2
votes
1answer
19 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 ...
-1
votes
0answers
44 views
Memory efficient alternative passing mostly static variables w/ 1 dynamic variable to an external function (COM) instead of a for loop in Python
Massive data problem, 7/8 variables are repeated 1000 times in a for loop, sending 8 input vectors * 50,000 values per loop for each function call. Only 1 input ...
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
42 views
0
votes
1answer
99 views
Parsing JSON in one go using state machine solution
I need to parse a simple JSON string (flat JSON, no hierarchy) for keys and values, and there is a system constraint that I cannot use any built-in JSON library and can only read a string once due to ...
3
votes
5answers
122 views
3
votes
1answer
34 views
Something to store any (standard) data in python
I decided to try make my own way to save normal python data yesterday after coming across the minecraft NBT format, it's more limited than cPickle but appears to produce shorter results and so far ...
7
votes
2answers
40 views
CLI Twitter client in Python
Here is a simple client for Wwitter that I wrote based on the twitter library in Python. The aim is to be able to read the feeds from different twitter accounts ...
5
votes
0answers
42 views
Copy files mentioned in an Excel sheet
Please help me in reducing the time complexity of this code as it is taking a long time to read its Excel input.
...
2
votes
2answers
97 views
Functions to merge dictionaries with a comparison
I have several functions for merging some dictionaries but over time I created a more general function that would make all these others obsolete if it weren't slower.
I have the specialized (and ...
1
vote
2answers
29 views
XML Python can this be improved
ok spent ages on this simple problem (I'm not good at XML) below code is probably self explanatory and it works, but i think this could be done a lot easier
Sample XML
...
5
votes
1answer
66 views
Text Based: Player vs Player Tic-Tac-Toe
Just looking for a review on my code, its currently only player vs player, but I'll be working on the AI soon enough. Functions edit_name, tutorial, and AI have been left out as I haven't started work ...
2
votes
2answers
57 views
Counting significant figures in a number
I decided to make something to count the significant figures in a number to see how easily it could be done, but I think there may have been a better or simpler way. Any advice even just for ...
5
votes
3answers
151 views
Duplicate-preserving collection intersection
Python sets are magical things. Mutable, deduplicating data stores with handy operator overloads for &, ...