Path: ...!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Dominique Newsgroups: fr.rec.jeux.enigmes Subject: Re: [Solution] F-Nim Date: Wed, 21 Dec 2022 04:02:02 +0100 Organization: A noiseless patient Spider Lines: 28 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 21 Dec 2022 03:02:02 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="51363c83a0b682e898eede77d5881ff6"; logging-data="994862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+6TbzbC6ybASadU0cuUADC4L2vdGCaCs=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Cancel-Lock: sha1:0a2zFiSK3IeauKc2doBeT19REGA= In-Reply-To: Content-Language: fr Bytes: 2442 Le 20/12/2022 à 22:15, Olivier Miakinen a écrit : > Le 20/12/2022 08:01, Dominique répondait à Jacques Mathon : >>>> ... >>>>>      s = "s" if (have > 1) else "" >> >> Merci Jacques, je n'aurais jamais pensé à cette façon d'écrire une >> condition. Python est un langage vraiment très souple. > > Je me trompe peut-être, mais je crois que cette syntaxe vient du > langage Perl. > Pourtant, cette écriture fonctionne très bien en Python : have=2 s = "s" if (have > 1) else "" s Out[106]: 's' have=0 s = "s" if (have > 1) else "" s Out[109]: '' -- Dominique Esto quod es