Path: ...!news.mixmin.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp1-2.free.fr!not-for-mail From: michel@domain.invalid Newsgroups: fr.comp.lang.python Subject: Re: =?utf-8?Q?D=C3=A9composition?= d'un nombre en facteurs premiers. References: User-Agent: Gnus Mail-Copies-To: never Date: Sat, 25 Mar 2023 12:28:28 +0100 Cancel-Lock: sha1:dAmz/4i/qdIaR/l9hFY/LL8OYI0= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Lines: 21 Message-ID: <641edb39$0$2992$426a74cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 25 Mar 2023 12:30:01 CET NNTP-Posting-Host: 82.66.159.6 X-Trace: 1679743801 news-2.free.fr 2992 82.66.159.6:57796 X-Complaints-To: abuse@proxad.net Bytes: 1411 Le 25 mars 2023 Dominique a =C3=A9crit : > Ce script aurait-il pu =C3=AAtre am=C3=A9lior=C3=A9 ? Je suppose que oui,= mais comment ? Le test nb=3D=3Dcpt est inutile car utilis=C3=A9 qu'une seule fois =C3=A0 l= a fin. Et la variable test peut =C3=AAtre int=C3=A9gr=C3=A9e dans le while : nb =3D int(input('Nombre ')) facteur =3D 1 test =3D nb liste =3D [1] while test > 1: facteur +=3D 1 while test % facteur =3D=3D 0: liste.append(facteur) test =3D test / facteur print('Les facteurs de', nb, 'sont', liste)