PASTEBIN
| #1 paste tool since 2002
create new paste
tools
api
archive
real-time
faq
PASTEBIN
create new paste
trending pastes
sign up
login
my settings
my profile
Public Pastes
Untitled
C# | 1 sec ago
Untitled
2 sec ago
Fileape Premium Ac...
4 sec ago
Facebook cracker
10 sec ago
Untitled
6 sec ago
Import Excel file ...
8 sec ago
Untitled
9 sec ago
RAPIDSHARE YOUPORN...
21 sec ago
Untitled
By: a guest on Jan 23rd, 2012 | syntax:
None
| size: 0.32 KB | hits: 20 | expires: Never
download
|
raw
|
embed
|
report abuse
Copied
def has_n_consecutive_numbers(n, xs):
count = 0
last = 0
for x in sorted(xs)[:n]:
if last:
if x == last + 1:
count += 1
if count >= n:
return True
else:
count = 0
last = x
return False
create a
new version
of this paste
RAW Paste Data
def has_n_consecutive_numbers(n, xs): count = 0 last = 0 for x in sorted(xs)[:n]: if last: if x == last + 1: count += 1 if count >= n: return True else: count = 0 last = x return False