Deutsch English Français Italiano |
<66d7f0aa$0$3586$426a74cc@news.free.fr> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!2.eu.feeder.erje.net!feeder.erje.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed4-a.proxad.net!nnrp5-1.free.fr!not-for-mail From: Damien Wyart <damien.wyart@free.fr> Newsgroups: fr.comp.lang.python Subject: Re: Panne de =?iso-8859-1?Q?m=E9moire?= avec print... Organization: Serveur de News Free References: <vb7a16$3crhi$1@dont-email.me> Date: Wed, 04 Sep 2024 07:31:22 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Lines: 40 Message-ID: <66d7f0aa$0$3586$426a74cc@news.free.fr> NNTP-Posting-Date: 04 Sep 2024 07:31:22 CEST NNTP-Posting-Host: 86.252.47.27 X-Trace: 1725427882 news-1.free.fr 3586 86.252.47.27:37334 X-Complaints-To: abuse@proxad.net Bytes: 1902 * Dominique <dominique.sextant@orange.fr.invalid> in fr.comp.lang.python: > liste=[] > dic=set() > for i in range(8): > for j in range(1,8): > if i/j>=0 and j>i or (j==7 and i==7): > res=[i,j,i/j] > result=i/j > if result not in dic: > liste.append(res) > dic.add(result) > print(liste, len(liste)) > Mais la sortie du print est toute moche et je ne sais plus comment > faire un print propre � l'image de ce que j'obtiens en appelant lise > directement hors script. Je propose : ,---- | import pprint | | liste = [] | dic = set() | | for i in range(8): | for j in range(1, 8): | if i / j >= 0 and j > i or (j == 7 and i == 7): | res = [i, j, i / j] | result = i / j | if result not in dic: | liste.append(res) | dic.add(result) | pprint.pprint(liste) | print(len(liste), "\n") `---- -- DW