New answers tagged python-3.x
1
vote
Python 3 tkinter calculator
It's a small note, but let's take this:
self.number_buttons = []
And this:
...
1
vote
Python 3 tkinter calculator
Portability
I get syntax errors due to illegal indentation:
def bind_keys(self):
"""
Binds events to keyboard button presses.
"""
The ...
3
votes
Catch the turtle - Python
Overall, this looks good! Here are my suggestions, which are a bit more specific to the turtle library than the existing review:
Use onkeypress rather than ...
0
votes
Calculate the median value of combining two sorted lists
Let's break the merging of two lists out into a function. And for fun, let's have the function return an iterator rather than eagerly working on both lists.
...
0
votes
Python project to scrape webpages and build text datasets for ML purposes
Returning None
If we look at download_text there is an opportunity.
...
8
votes
Python project to scrape webpages and build text datasets for ML purposes
comments
Lines of code: ~200
I'm sure that was true when you wrote it.
Looks like you've added a hundred or so lines since then.
Comments tend to bit rot as the codebase evolves,
which is why we ...
4
votes
Python project to scrape webpages and build text datasets for ML purposes
Overview
The code layout is good, and you added ample documentation with usage examples.
try/except
In the download_text function, the ...
7
votes
Python project to scrape webpages and build text datasets for ML purposes
You have docstrings and comments that are very useful. Your code also seems to be very well organized and structured. The API is simple enough. My only questions/suggestions are:
Security Concerns
You ...
5
votes
Moving ball simulation within a donut
resolve_collisions() tests the separation of every pair of balls, so its complexity scales as O(n²).
Consider dividing the box into sub-areas, so we only have to ...
2
votes
Moving ball simulation within a donut
More Descriptive/Accurate Docstrings
Since you have chosen to use docstrings instead of type hints, then try to be more precise is describing what the arguments to the functions are. For example, I ...
2
votes
Moving ball simulation within a donut
I don't have any advice about performance, but here are some general
coding style suggestions.
DRY
This expression is used several times:
box_size/2
You can set it ...
1
vote
Solve a system of linear equations with Gauss algorithm
I somewhat doubt that the original poster is still around, but for posterity:
700 lines is too long for such a program. It's too hard-coded (a, b, ...), and not flexible enough - it only supports up ...
2
votes
Solve a system of linear equations with Gauss algorithm
Not only are names like a1 and b2 non-descriptive, but they all of these objects should probably be in lists or dictionaries ...
2
votes
Solve a system of linear equations with Gauss algorithm
UX
When I run the code, the GUI title has the acronym "LGS". It would be
helpful to spell out the acronym somewhere in the window.
Also, I do not know what I should enter into each field. ...
0
votes
A tabbed calculator with tkinter
Portability
I get a syntax error when I run the code:
NameError: name 'my_subtraction' is not defined
In all_tabs.py, this line ...
3
votes
Calculation of liquid propellant nozzles
I don't really understand any of this, so I can only speak as a programmer, but the code looks good and fairly well structured. Naming conventions make sense in plain English even to an outsider.
If ...
2
votes
Accepted
Calculation of liquid propellant nozzles
Overview
The code layout is good, and you used meaningful names for classes,
functions and variables. It seems like the code is already structured for future enhancements.
Long lines
There are a ...
2
votes
Timer with input, sound and flashing
Portability
When I copy the code out of the question and try to run it, I get syntax errors due to indentation. Perhaps your indentation mixes single spaces with tab characters on the same line, and ...
1
vote
Calculation of Correlation Time
Here are some general coding style suggestions.
Unused code
This variable is set but never used:
start_time = time.time()
It can be deleted, which means this line ...
1
vote
Web scraping data from website using Selenium
Portability
When I run the code, I get a syntax error on lines like this:
...
1
vote
Snake game in pygame with varying velocity
Imports
The import lines should precede all executable code; move the init call:
...
Top 50 recent answers are included
Related Tags
python-3.x × 5347python × 5187
beginner × 821
performance × 642
programming-challenge × 448
algorithm × 324
object-oriented × 276
web-scraping × 205
game × 204
numpy × 177
pandas × 155
time-limit-exceeded × 144
tkinter × 140
strings × 136
reinventing-the-wheel × 106
parsing × 87
tic-tac-toe × 84
beautifulsoup × 82
console × 81
random × 80
csv × 79
file-system × 75
file × 74
mathematics × 74
hash-map × 73