From c330a3991db90c728b8096c211dc656b9ce962b9 Mon Sep 17 00:00:00 2001 From: Adrien Date: Fri, 11 Feb 2022 17:07:14 +0100 Subject: [PATCH] Add new python note about float round --- 20211230101535-python.org | 3 ++- ...20528-arrondir_les_flottants_en_python.org | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 20220206220528-arrondir_les_flottants_en_python.org diff --git a/20211230101535-python.org b/20211230101535-python.org index a16c604..1bad951 100644 --- a/20211230101535-python.org +++ b/20211230101535-python.org @@ -1,6 +1,6 @@ :PROPERTIES: :ID: 4fabfe6a-b104-464f-8a87-dfd7d761dbcc -:mtime: 20220130162518 +:mtime: 20220207072855 :ctime: 20211230101535 :END: #+title: Python @@ -35,3 +35,4 @@ Formatter n'appliquant que le style [[https://black.readthedocs.io/en/stable/the ** [[id:4ef76164-0e67-410a-8d26-b03071a0cc41][Compter la fréquence des éléments d'une liste]] ** [[id:cb3c63b9-6452-4016-9b2f-a25784941d5d][List vs deque]] ** [[id:9bdede16-5137-4393-a027-a5afbffd1618][Génération chaine de caractères aléatoires]] +** [[id:f7c05933-90e6-4a9c-acd5-1f0baf62f07f][Arrondir les flottants en python]] diff --git a/20220206220528-arrondir_les_flottants_en_python.org b/20220206220528-arrondir_les_flottants_en_python.org new file mode 100644 index 0000000..24e63f1 --- /dev/null +++ b/20220206220528-arrondir_les_flottants_en_python.org @@ -0,0 +1,26 @@ +:PROPERTIES: +:ID: f7c05933-90e6-4a9c-acd5-1f0baf62f07f +:mtime: 20220207072847 +:ctime: 20220206220528 +:END: +#+title: Arrondir les flottants en python +#+filetags: :Python: + +* Arrondir un nombre à l'entier inférieur +#+BEGIN_SRC python :results output +print(22 // 5) +#+END_SRC + +#+RESULTS: +: 4 + +* Arrondir un noombre à l'entier supérieur +#+BEGIN_SRC python :results output +print(22 // -5 * -1) +#+END_SRC + +#+RESULTS: +: 5 + +* Références + * [[https://www.delftstack.com/fr/howto/python/python-round-up/][Arrondir un nombre en Python]]