From 912692a4ae4fec97ab2233b7c591e979c848764d Mon Sep 17 00:00:00 2001 From: Samuel Vermeulen Date: Fri, 6 Jan 2023 00:06:27 +0100 Subject: [PATCH] up --- Fonctions/phenomene_numerique.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Fonctions/phenomene_numerique.py diff --git a/Fonctions/phenomene_numerique.py b/Fonctions/phenomene_numerique.py new file mode 100644 index 0000000..576f14c --- /dev/null +++ b/Fonctions/phenomene_numerique.py @@ -0,0 +1,11 @@ +def terme(valTerme: int): + if valTerme % 2 == 0: + return valTerme // 2 + else: + return valTerme * 3 + 1 + +nbTerme = int(input()) +while nbTerme != 1: + nbTerme = terme(nbTerme) + print(nbTerme, end=" ") +print() \ No newline at end of file