Path: ...!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Dominique Newsgroups: fr.comp.lang.python Subject: =?UTF-8?Q?Re=3a_Probl=ef=bf=bdme_boucl?= Date: Mon, 12 Sep 2022 18:20:42 +0200 Organization: A noiseless patient Spider Lines: 46 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 12 Sep 2022 16:20:43 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="2cae7bdcf1ba0d70ad7df28fb033e96c"; logging-data="2420828"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18//WgMkgAZvEVVcPUyhYZbkovLSo1Cbys=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cancel-Lock: sha1:+jTDMrnYIasrY7wgfinRmsYHqdg= Content-Language: fr In-Reply-To: Bytes: 2608 Le 12/09/2022 à 13:43, gigi123 a écrit : > Bonjour, > > Voilà j'aimerai que mon élément res[j] s'incrémente lorsqu'il trouve la > condition d'égalité avec la 2nd liste, sans sortie de la boucle while. > > voici le code : > > identique = True > a=0 #variable qui parcours ma 2nd liste > b=0 #compteurs catégorie urnes standars > c=0 #compteurs catégorie consommables > d=0 #compteurs catégorie urnes décoratives > e=0 #compteurs catégorie cyclavet > f=0 #compteurs catégorie bijoux > g=0 #variable qui parcours ma 1ère liste > j=0 #VARIABLE PREMIERE LISTE > > while identique == True and j==0 : > > if res[j] != conso[a]: > a = a+1 > > > if res[j]==conso[a]: > res[j]=res[j+1] > if conso1[a] == 'Catégorie A': > b=b+1 > else: > if conso1[a] == 'Catégorie B': > c=c+1 > else: > if conso1[a] == 'Catégorie C': > d=d+1 > else: > if conso1[a] == 'Catégorie F': > e=e+1 > else: > if conso1[a] == 'Catégorie G': > f=f+1 > > identique = False Bonsoir, D'emblée, je ne vois pas d'où sortent les variables res et conso. De plus, quel problème rencontrez-vous ?