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 |
Python 3 is the latest version of the Python programming language and was formally released on December 3rd, 2008. Use this tag along with the main python tag to denote programs that are meant to be run on a Python 3 interpreter only. Do not mix this tag with the python-2.x tag.
14
votes
Find the closest enemy
First of all, let's talk about magic numbers. smallest_distance = 100_000_000 is a problem. Where's the hundred million come from? When you have numbers in your code, there should ideally be a specifi …
6
votes
Accepted
Boggle Solver in Python
As mentioned in my comment, I was unable to download your word list. For testing I have used a file with the most common four thousand English words that I happened to have to hand. I ran 1000 iterati …
0
votes
Accepted
School Administration System in Python 3
This isn't a comprehensive review because that's not possible with incomplete code, but I think there's enough here to make a few remarks. First, a few things I like:
The careful control flow, inclu …
5
votes
Accepted
How good is this cipher? (Python)
I should start off by saying, as a standard disclaimer, that cryptography experts consistently recommend that the best way to implement a secure cipher is to let someone else do it! That's not to say …
5
votes
1
answer
412
views
Decorator to instantiate class on another process
Motivation
I want to run some compute heavy tasks on a separate process, so that they don't hog the GIL and I can make effective use of a multi-core machine.
Where those tasks are pure functions, I …
1
vote
TicTacToe in Python
There is a general principle in programming that you want to avoid repeating yourself. For example, you define the starting game set up twice, once in the reset function and once in the main script. Y …
1
vote
Accepted
merge_sort and unit testing
while x and y:
yield min(x,y)
if x <= y: x = next(xs, None)
else: y = next(ys, None)
This is correct. Note, however, that it is relying on the stability guarantee of min to ensure t …
5
votes
Accepted
Checking if a number is divisible by 2-11
There is a programmer inside joke that says "no self respecting ethical programmer would ever consent to write a bomb Baghdad function. They would write a bomb city function to which Baghdad could be …
3
votes
Accepted
Maximise XOR of two elements
As to the algorithm
The general rule here is don't search when you can calculate.
XOR is fundamentally a bitwise operation. Think about what the XOR operation is doing, on a bit by bit basis.
Firs …
2
votes
Income tax calculator
Hello @AMG_ and welcome to codereview.
One good thing here is checking that the user input is a number. It's a good habit to always assume user input is broken, and give them an indication of what's …
5
votes
Membrane protein diffusion in different confinement models
and welcome to Code Review.
With apologies, I should probably start with a bit of a disclaimer: I'm just on the way out of an infection and my brain is not working at full capacity. Obviously you shou …
2
votes
GIF/PPM to greyscale converter
There are some very good things about this code.
It makes good use of library functionality, which is one of the big strengths of Python. A lot of programmers spend unnecessary amounts of time rewri …
6
votes
Accepted
Scraping NHL Individual stats
I will make a few points about the code as code, but the first thing to consider in any sort of data collection is respecting the rights of the owners of the data.
In particular the terms of service …
3
votes
Accepted
A recursive Boggle solver
The problem that you observe with this program is speed, so let's look at that.
Running the program, I immediately noticed that the get_permutations section was slow, and the dictionary_check sectio …
5
votes
Accepted
HarckerRank 2D Arrays Hourglass challenge
One thing I like about this code is the clear division of role.
You have a section for identifying and extracting the hourglasses. Then you sum the individual hourglasses. Then you find the maximum. …