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 is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability. Use the python tag for all Python related questions. If you believe your question may be even more specific, you can include a version specific tag such as python-3.x.
6
votes
1
answer
158
views
Python3 - Prime Sieve
I've implemented two prime sieves in python 3 to find all prime numbers up to an upper limit n - n exlusive. … len(sieve), 2*j + 1):
sieve[i] = False
return [2] + [2*index + 1 for index, is_prime in enumerate(sieve) if is_prime]
My questions regarding this code are:
How does my general python …
0
votes
2
answers
95
views
Finding length of cells in a row
I'm facing the following problem: I have a row of cells. Some cells are available, some are not. Every cell is associated with a cell_id. I want to determine the length of cell. This length of a cell …
12
votes
6
answers
4k
views
Python 3 - Fibonacci Implementation
I wrote a function returning the n-th Fibonacci number in Python 3:
# Functions returns the nth Fibonacci number F_n
# Parameters: n >= 0, (Optional: F_0, F_1)
def fibonacci(n, f0=0, f1=1):
if n = … The functions returns the n-th Fibonacci number, but n=0 returns the first Fibonacci number (this is a special case)
I'm new to Python and any general style guide is welcome. …
5
votes
1
answer
8k
views
Python 3 - Get n greatest elements in dictionary
Given an dictionary with lists as values this piece of code is dedicated to find the n keys with the longest lists as values. It works, but there has to be a more elegant solution.
def get_n_longest_ …