All Questions
Tagged with python-3.x python
5,164
questions
3
votes
3
answers
168
views
Basic python rock papers scissors game (first code)
I'd just appreciate if anyone can suggest some incremental improvements that would help me to think better like a coder.
Here is the very basic RPS (rock, paper, scissors).
One thing I may next add is ...
2
votes
1
answer
123
views
Dial up some obscure stats for the Chutes and Ladders game
Years ago, I wrote some code in Perl
for the Chutes and Ladders game. I re-wrote the code here in Python.
The code simulates one player in a game to see how many spins of the dial
are needed to win ...
12
votes
2
answers
1k
views
Space shooter game using pygame
I have made a space shooter game in pygame with over 800 lines of code (including blank lines). The aim of the game is to kill all of the ships in the game. You start with a small spaceship and one ...
1
vote
0
answers
56
views
Django Google Authentication App Using OAuthlib and DRF
Context
I've been working on a Django-based Google Authentication application, designed to manage OAuth authentication without relying on libraries such as ...
3
votes
1
answer
81
views
Multiline string concatenation
Problem Description
Printing the result of adding two numpy arrays together is very ugly.
Here we will use these numpy arrays as an example:
...
4
votes
1
answer
75
views
Centre of mass based TSP solution (2)
I updated the code to a working state. My previous question. Even if this code working I wonder if I can write this code in a more efficient way. Maybe less for loops Etc.
...
2
votes
2
answers
85
views
Checking file header for magic number in Python
I wrote this to check files for successful compression with LZ4.
Any advice is welcome.
Particularly regarding raising exceptions and error handling.
...
3
votes
3
answers
171
views
Converting a dict to a list + ID
I wrote this code:
PROJECTS_LIST = [
project if not project.update({"project_id": project_id}) else None for project_id, project in PROJECTS.items()
]
...
0
votes
1
answer
105
views
Centre of mass based TSP solution
This is the code that I tried to approach to the traveling salesman problem in a new way. As you can see, it does not give such great results. Can I get this idea further, or should I quit to ...
2
votes
1
answer
45
views
A selenium web scraper to package NBA data
I'm building a selenium web scraper for basketball-reference.com that takes a player name and returns data in either a JSON format or Pandas DataFrame object. The class in question is one of many that ...
2
votes
4
answers
661
views
Adding Node to Linked List
I've been programming for 3 months now, and I've just come across Linked List, and I'm not gonna lie, I've been struggling a little. I wrote this code to practice on Linked Lists. The purpose is to ...
4
votes
4
answers
1k
views
Creating an O(n) algorithm for an array of integers
To avoid plagiarism in my university, I am going to modify the problem.
Henry likes to jump from building to building. The heights of each building are given as a list of H numbers. We also number ...
4
votes
2
answers
288
views
Simple version of NEAT
I have wrote my own simple version of NEAT and want to improve the code for mainly performance
(training and runtime of a generation).
This simple version of NEAT aims to perform somewhere near as ...
3
votes
1
answer
122
views
Miller-Rabin implementation is very slow
I implemented the Miller-Rabin-Primetest in python3. But I have the feeling it is very slow. I know that there are faster version in gmpy2 package, but I want to compare it with another code I have in ...
3
votes
1
answer
86
views
Sorting songs with the ability to save and resume partial sorts
I listen to a lot of music (~4k h/y) and managing thousands of songs is a bit of a challenging.
To improve my listening experience I want to better organize my collection.
One thing I want to do is ...