We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [python]

Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.

Filter by
Sorted by
Tagged with
0
votes
1answer
7 views

Algo for generating a fake, but feasable, dataset

So, I was working on a dashboard for a potential customer and I needed a fake dataset with employee information to demonstrate. Mainly, I needed to know when the employee arrived the company (first ...
0
votes
0answers
5 views

Python anagram solver - setting max word size

I have an anagram solver but there's no way to set the number of words contained in a single string. If I have the anagram 'ellholordw' I want to be able to tell it to look for all permutations ...
6
votes
1answer
78 views

Optimizing a raycasting/voxelspace algorithm in Pygame

In the past three days, I've been developing a simple raycasting algorithm. I've made the renderer work as I'd like to. However, it is extremely slow (5 frames per second) because of two things (as ...
0
votes
0answers
2 views

Pong game in Python with tkinter (With score)

Previous question: Pong game in Python with tkinter This code is almost same as the last code, but it also has a score system. But it also has a few more bugs and takes more time to run. Code: <...
1
vote
0answers
31 views

Pong game in Python with tkinter

This is a pong game I created some time ago, but it doesn't have methods to store scores yet and also might have some bugs. It is also very slow. The code: ...
8
votes
3answers
2k views

Single Player Python Battleship Game

I made a battleship game for a programming class, where I only had about a week to get it done. Under this time crunch, and the fact that I don't know python very well, I made some of the code in very ...
3
votes
1answer
27 views

Plot timings for a range of inputs MkII

To celebrate questions getting more reputation points per upvote, I would revisit my previous issue, Plot timings for a range of inputs. Since the time of that original question (more than two years!)...
4
votes
1answer
27 views

Average row id volume

After a test run with LoadRunner I wanted to know the average time for each transaction for each VU volume step, the LR let you create a graph for this but don't give you the point values... so it's ...
3
votes
1answer
40 views

unique username generator

I have written a class to generate a unique username from the full name. The full name is the name of a company usually containing 4 to 5 words. The username generated will be of format {preffix}{...
6
votes
1answer
308 views

Python Perceptron

This is my finished perceptron written in python. Is there anything that I can improve/suggestions? I'm a beginner with python so anything would be helpful! ...
1
vote
1answer
59 views

Reuse the value of previous type instead of None [on hold]

I've created a function in python to print some information through it. I'm trying to supply list of alphabets to the function along with the type those alphabets fall under. When I execute the ...
3
votes
2answers
107 views

New to programming. How can I write this Rock, Paper, Scissors code better?

I am practicing w/ Python and wanted to code a simple Rock, Paper, Scissors game w/o any user input. I used a list to hold the values and randomly pulled them with a function. I used the the return ...
7
votes
1answer
144 views

Basic Python HTTP Server

It's an extremely simply HTTP server in Python using the socket library, and a few others to get the MIME type, etc... I've also avoided the ../../ vulnerability, ...
-3
votes
0answers
48 views

Recursion on graphs - networkx VS adjacency lists with native lists and sets ( python ) [on hold]

hope someone can help me out in reviewing this code to make it faster. My goal is to create a graph recursively: query for a node and its neighbors from a db (not present here) add it and its ...
8
votes
2answers
273 views

NLP sentiment analysis in Norwegian

Please keep in mind that I am very new to data science and completely new to NLP! I am trying to create a model to classify customer reviews as either negative or positive. However, my main problem is ...
2
votes
0answers
29 views

Automate html file editing with python - Change the author

Hello I would like to use python to change the author of an html file, in order to do so I have written a few lines. First I have used the HTMLParser class from ...
5
votes
1answer
125 views
7
votes
1answer
342 views

Optimize Performance of Region Checking in List Comprehension

I am modeling a linear process at a number of equally spaced time steps. I have a large list (~70k elements) which corresponds to a location at each time step, ...
4
votes
0answers
60 views

Liveness monitor : python and RabbitMQ together through Pika

I'm a beginner using Python, and I'm trying to implement a functionality of a monitor program already developed by an other programmer. This program is working on a Windows machine (made by Inno ...
3
votes
0answers
121 views

The parking machine implementation

I am interesting in the topic of finite automata, so I started over by implementing a parking machine from this video: Computers Without Memory - Computerphile to understand conceptions. Didn't do ...
3
votes
1answer
37 views

CliwPw - Yet Another Python3 Password Manager

I wrote a (very) simply Python3 password manager to familiarize myself with Sqlite3, and for fun. I am aware that there are already a variety of password managers out there, but I wanted something ...
1
vote
1answer
49 views

Reduce the execution time utilizing two apis

I am new to python. I have been given a task to verify the data from 2 apis which give similar data but in different format i.e. Json and XML. I have written the code but it is taking too much time to ...
12
votes
4answers
899 views

Parsing C-like code to extract info

I'm reading a file with the following data, ...
3
votes
1answer
47 views

Scraping IMDB and exporting to JSON or/and CSV

This code is scraping the data from IMDB and displays it in JSON or CSV format. I plan to extend it beyond the top rated movies. How can I improve the quality of my code? I am using Python 3.7.3. <...
-3
votes
0answers
39 views

calll python script from C# in considering performance impact [on hold]

I am calling python script from C# code that crop image. Is there any better way to do it? This is the first time I am doing it, so I wanted to have other opinion/ways of doing it. Important ...
4
votes
1answer
73 views

Automating a set a of weekly reports, including graphs and delivery of reports

I have been writing code to automate some weekly reports. I had help over on Stack Overflow. I have code that works for the most part, however there are a few things that I just can't seem to fix. In ...
4
votes
0answers
38 views

Snake game in Python with tkinter

I created snake as my first program with GUI, I didn't learn OOP yet, so my program has no classes. I know that I should use comments, I am sorry. Short instruction: l - increase snake speed k - ...
2
votes
1answer
46 views

Interactive Tower of Hanoi

I created this program some time ago. It shows you how to solve tower of hanoi for n disks, step by step. Here's the code: ...
2
votes
1answer
51 views

Object oriented hangman game

I'm a hobbist trying to become a professional software developer. I do have a lot interest in Data Science in general and my goal is to master Python before diging deeper into specific data science ...
-3
votes
0answers
26 views

Matrix class problem in Python [on hold]

Please bear in mind this is an early version of the class - I am aware that I am getting instances all wrong, but that will change later. I have a problem with this code: ...
0
votes
1answer
51 views

Hangman Game using python3

Summary I made a hangman game using python but I had trouble writing clean pythonic code Questions In the code snippet I provided (Full code in the link below) I used global for: loop and points ...
5
votes
3answers
89 views

Simple run-length encoding decoder

For practice, I decided to write a run-length decoder. For example: ...
-2
votes
0answers
20 views

Histogram building in python, specific on one variable [on hold]

Below is the dataset im using to build the histogram. I want to build a histogram which specifies on the 'EL' variable and where we have the frequency on the y-axis. Is it possible to group the 'EL' ...
1
vote
0answers
34 views

X in a Line Console Game - Python OOP

Please could you review my code below? The game is similar to "Connect 4", but I haven't implemented diagonal checking for wins. In particular I'm interested in my use of OOP. E.g. My choice of ...
2
votes
1answer
45 views

Import/Export data from/to json using python

I developed a code in python that: add name, age and Id information for each person, search a person by name, if it exists then display a message "Found" and fill "age" and "Id" with the ...
4
votes
1answer
29 views

Plotting shapely polygon in matplotlib

When working with geometric objects I like working with the shapely module (Shapely - PyPI). In here it is easy to create polygons and define union, intersection and differences. Like so: ...
3
votes
1answer
39 views

Map price values to bins where bins are of a larger price range

I have two different pandas data frames where in the first data frame (price), I have two columns. The first column named value has some values in it and the second column amount has the available ...
4
votes
3answers
2k views

Python Barcode Generator

I was asked to provide some example code for a job interview and didn't have anything to offer, so wrote the following function. A barcode generator may seem a bit basic, but there's some logic ...
6
votes
2answers
630 views

Python Barcode Generator v2

This is a complete rewrite of the code posted for review in this question. The question is identical. ...
-1
votes
0answers
24 views

text based adventure-game to defeat an attacking NPC [duplicate]

print("Welcome player! Defeat the enemy in Hell to win, die and you lose!") print("You can take an item you see in the room, you have to have an item in your bag") print("(which means you have ...
5
votes
3answers
225 views

Log monitoring with pythonic tail -f and process killing

The purpose of this cluster of functions is to tail the log file and kill/restart processes from shell (the latter is not yet implemented). ...
-6
votes
0answers
34 views

text based adventure game [on hold]

I am new to coding and don't really know how to do much but its a requirement for a general education class so i was wondering if someone could help me build and text based adventure game. i need help ...
2
votes
2answers
68 views

hash image url and if valid store image url

I am trying to get all image urls which are valid and unique.To make sure i wont end up using the same image again i calculate hash of the image and store it in a text file and read the text file ...
-2
votes
0answers
25 views

restaurant rating [on hold]

hi all im brand new to this and found this site to be very helpful i just wanted to know if im headed in the right direction. this is my scenario A program is required to prompt users to rate a ...
1
vote
0answers
30 views

Basic pygame menu with buttons

I'm new to python and newer still to pygame. In my attempt to learn, I set to make a basic menu with buttons. Here's my code: (note, ui_plate, is a system that the buttons are based on, it keeps all ...
4
votes
0answers
46 views

Python Project Template

What's up smart people. A little backstory for context: I'm a completely self taught dev, and the only person ever looking at my code for the past 6 years is myself. I realize that's not the best idea ...
7
votes
4answers
15k views

Algorithm to get an arbitrary perpendicular vector

Is there a more efficient/direct way to find an arbitrary perpendicular vector of another vector? ...
11
votes
5answers
2k views

A Simple Battleship Game

I have just finished learning basic-intermediate Python subjects and wanted to test myself. This Battleship game is the third game i have written. ...
5
votes
3answers
945 views

Receive a list of names and return a list of users - HackerRank test

So, few months ago I did a HackerRank test for a company. The problem was to create a function which receive a list of names and returns a list of unique usernames. For example: For the list of <...
5
votes
1answer
241 views

Solving Subset-Product in Python

I've written a python script that solves a restricted variant of Subset Product by using integer factorization. The purpose of the script is for my empirical observations of the similarities between ...