Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <8734pd7v1r.fsf@nightsong.com>
Deutsch   English   Français   Italiano  
<8734pd7v1r.fsf@nightsong.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Paul Rubin <no.email@nospam.invalid>
Newsgroups: comp.lang.python,comp.lang.lisp
Subject: Re: diff1(x) in Python: True if all adjacent items differ by 1, False otherwise.
Date: Sat, 15 Jun 2024 14:30:56 -0700
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <8734pd7v1r.fsf@nightsong.com>
References: <v4kuk5$3k353$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 15 Jun 2024 23:31:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="10e676ec212f80670e94fe2bb9c0f8f5";
	logging-data="3837891"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX187HbrTMB1Tnk05Rmz+ivbe"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:/rI+4/Tglnr0dG9kzJgXuxmUD0Q=
	sha1:Z0Pt4fCu76qjCSOK4wmDRNfRv00=
Bytes: 1260

HenHanna <HenHanna@devnull.tb> writes:
> def diff1(x):
>     if len(x) <= 1: return True
>     for i in range(len(x) - 1):
>         if abs(x[i] - x[i+1]) != 1:    return False
>     return True

def diff2(x):
  return all(abs(a-b)==1) for a,b in zip(x,x[1:]))