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 …
13
votes
Python program to calculate GCD
If you want to know whether there are more efficient algorithms than Euclid's, this is probably the wrong place to ask. Even Wikipedia would be a better starting point. The answer is yes but they are …
11
votes
A program that prints the longest substring of s in which the letters occur in alphabetical ...
if second>=len(s):
break
This is not necessary. You have just checked that in the loop condition.
first=0
second=1
strang1=''
strang2=''
Consider renaming these variables to say what they d …
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 …
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 …
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 …
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 …
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 …
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. …
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 …
4
votes
Password hashing for safe storage with Argon
Argon2 is a decent choice of hash. Well done for following the most important rule of cryptography, and letting someone else design and implement the cryptography!
There are a few minor style things w …
4
votes
2D array inquiries
I like the pre-initialisation approach.
One thing that you should look into is replacing explicit lists and append with approaches that operate on lists directly. List or generator comprehensions sh …
3
votes
Flexible 2P TicTacToe
You should code to make sure that user input doesn't break any assumptions you are making about the game. For example, I like the gimmick that the players can pick a symbol. However, you should make s …
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 …
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 …