Search Results
| Search type | Search syntax |
|---|---|
| Tags | [tag] |
| Exact | "words here" |
| Author |
user:1234 user:me (yours) |
| Score |
score:3 (3+) score:0 (none) |
| Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
| Views | views:250 |
| Code | code:"if (foo != bar)" |
| Sections |
title:apples body:"apples oranges" |
| URL | url:"*.example.com" |
| Saves | in:saves |
| Status |
closed:yes duplicate:no migrated:no wiki:no |
| Types |
is:question is:answer |
| Exclude |
-[tag] -apples |
| For more details on advanced search visit our help page | |
Results tagged with beginner
Search options not deleted
user 123200
Add this tag to your question to indicate that you are new to the language of your code. This will often be taken into consideration by reviewers when assessing your code.
5
votes
Accepted
Simulation of virus growth
Files
Python is not Java, not every class needs it's own module. You can keep Details, Virus and Person in 1 file, Display can go in its own file, since that serves another purpose
Programming tools …
2
votes
Renumbering files in a folder consecutively
Indenting
I don't like this style
def get_digits_minimum_length(filenames: List[str], file_prefix: str,
file_type: str, start_number: int) -> int:
I'm more a fan of
…
2
votes
Accepted
Customer segmentation using RFM analysis
This can be done a lot simpler.
Since all of rfm returns in result, you can do a copy. To make sure that even if you reorder things, they appear at the correct place, you use an index. Since Id is un …
5
votes
Accepted
Countdown numbers game (Solution generator)
Like the other answers say, split up your program.
A few nice ways you can split it up, and make it more efficient at the same time is to change the way the sequences are generated.
import operator
…
2
votes
Finding length of cells in a row
A lot of why this code looks not so clean to me is because of the clunky Selenium interface (cell.get_attribute('id')) instead of cell['id'] or cell.id for example)
The other reason why this looks le …
7
votes
Program for swimmers to evaluate their training
functions
Instead of 1 large script, that gets done line per line, split it into logical functions, this allows for code-reuse.
Use 1 main-method, that you call behind a if __name__ == '__main__':-g …
5
votes
Function to check whether entire list is prime numbers
for each number in lista, you iterate over the range(3, int(sqrt(n)+1), 2). You even unnecessarily instantiate this range to a list.
You have 2 alternatives.
You test each element in lista with a …
1
vote
Looping through a tree to get branch or leaf
all in all this code does what it needs to do, but czan be improved in some small points
Exception
Instead of the try-except clause, just let the exception bubble up to the caller if he passes a wro …
7
votes
Basic calculator in Python
sum
you use sum as a variable name, shadowing the builtin, which is generally a bad idea
function
Divide the program into functions with their own goal. Here you have following part
get the 2 num …
4
votes
Accepted
My first Python project Tic Tac Toe v2
magic numbers
I see the value 3 (and 9) in your code when it refers to the board size. It is best to prevent such magic number, and either replace them with variables, or with constants
BOARD_SIZE = …
5
votes
Accepted
Simple 2 player Tic tac toe game
documentation
You document the methods with # above the code and specify the types of the arguments like this too. Python has a builtin way to annotate the type, and uses """ to delimit a docstring
s …
4
votes
Object-oriented student library
Separate the logic and data from the presentation
return or yield, don't print. This way your code can be used in other programs that might reuse this.
set
Your Library and StudentDatabase uses li …
5
votes
Priority based categorization using pandas/python
Instead of grouping by the invoice on each category, I would reverse the logic.
Group per invoice, and then classify that invoice.
categories = pd.concat(
classify_invoice(data) for invoice, data …
2
votes
Raspberry-Pi morse-code LED
a slight adaptation of stefan's excellent answer
I would implement the read_codes like this, using csv, filter. And keeping in mind these excellent talks (1, 2) by Brandon Rhodes about bringing out t …
4
votes
Project Euler #3 with Python
timing
Put the code to time the run time of the function outside of the function.
augmented assignment
value = (value // i) can be expressed as value //= i
divisors
Why do you need to keep a list of d …