Weekly backup.
This commit is contained in:
26
20220516151958-any_et_all_d_un_iterable_vide.org
Normal file
26
20220516151958-any_et_all_d_un_iterable_vide.org
Normal file
@@ -0,0 +1,26 @@
|
||||
:PROPERTIES:
|
||||
:ID: 16d16a4b-6a4c-4597-a45f-1a99f2cb9f29
|
||||
:mtime: 20220516154116
|
||||
:ctime: 20220516151958
|
||||
:END:
|
||||
#+title: Any et all d'un iterable vide
|
||||
|
||||
* Introduction
|
||||
#+BEGIN_SRC python :results output
|
||||
print(f"{any([])=}")
|
||||
print(f"{all([])=}")
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: any([])=False
|
||||
: all([])=True
|
||||
|
||||
* Explications
|
||||
* La fonction /build-in/ /any/ recherche le premier élément ~True~, et si aucun n'esst trouvé, retourne ~False~ (cas
|
||||
lorsque une /list/ est vide), sinon ~True~.
|
||||
* La fonction /build-in/ /all/ recherche le premier élément ~False~, et si aucun n'est trouvé, retourne ~True~, ~False~ sinon.
|
||||
|
||||
* Références
|
||||
* [[https://medium.com/@saint_sdmn/10-hardest-python-questions-98986c8cd309][10 Hardest Python Questions - Medium]]
|
||||
|
||||
|
Reference in New Issue
Block a user