Skip to main content
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
Search options not deleted user 118790

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.

1 vote
Accepted

Find two distinct subsets of a list that add up to the same value

Some "more pythonic" suggestions which also improve performance: use Counter.elements() in partition_into_equal_parts this code: second = [] # Fill second with items from counter second_counter = …
Jean-François Fabre's user avatar
2 votes

REST API for random number generation using Falcon

This is a small code, but there are some improvements to make: useless copy-paste, what if you had 5 conditions?: if 'min' not in req.params: raise falcon.HTTPMissingParam('min') if 'max' not …
Jean-François Fabre's user avatar
0 votes
Accepted

Parse xml and store into mysql table in python

I didn't test your code but there's a big block of copy-paste only to generate the arguments to pass to zip. So the alternative is to generate the arguments "anonymously" from the tag names only, and …
Jean-François Fabre's user avatar
2 votes

Raspberry-Pi morse-code LED

I'm seeing 2 parts that could be improved: for row in readCSV: #fill up the new lists letter = row[0] code = row code.remove(row[0]) you could get letter and code in a single line li …
Jean-François Fabre's user avatar
5 votes
Accepted

Counts instances for each category for many Matlab files

You felt it right, there's a lot of unnecessary copy/paste in the first part. Your 5 data structures are similar, and you create a lot of variables to perform the same processing 5 times. I did a qu …
Jean-François Fabre's user avatar
0 votes
Accepted

CSV file parser and compare

My advice: use tuples for keys, not string concatenation One thing I can suggest: don't create your keys using string concatenation because this particular operation is not optimal at all and alloc …
Jean-François Fabre's user avatar
3 votes
Accepted

Knapsack greedy algorithm in Python

list comprehensions aren't too useful in that code. Well, I think I can help improve your code anyway: valuePerWeight = sorted([[values[i] / weights[i], weights[i]] for i in range(numItems)], reverse …
Jean-François Fabre's user avatar