Deutsch English Français Italiano |
<zM6dnZ5wDbXEsGr8nZ2dnUU7_8zNnZ2d@giganews.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 30 Jan 2022 18:29:13 -0600 Newsgroups: fr.comp.lang.python Subject: Sortir d 'une boucle while X-poster: PEAR::Net_NNTP v1.5.0 (stable) From: Cyrion81 <nospam_thy.prog@orange.fr.invalid> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Organization: !No_Organization! Message-ID: <zM6dnZ5wDbXEsGr8nZ2dnUU7_8zNnZ2d@giganews.com> Date: Sun, 30 Jan 2022 18:29:13 -0600 Lines: 49 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-Sev/lL00nlGK7pTGIXfq8ugZ/hz4EBX7LloCK4lfumIyBfjuP0fsbHKF2xQPB3aG9jzL4TeGeHSC+sC!FUict+b3bo73MGtzDHEF3D2aVSHROaQZu26L0fi3D+SBFM6Qj4FbYJPYz7zqQ4Ged5FzXWfV8stD X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Bytes: 2569 X-Original-Lines: 47 Bonsoir Je débute en python et j’ai voulu faire un programme qui ajoute un élément dan une liste, qui peut afficher la liste ainsi que quitte le programme. Je n’arrive pas a quitter le programme Merci de votre aide choix ="" liste_elements = [] liste_choix=[1,2,3,4,5] while True: #menu choix affiché choix ="" print( ) print("--------------------------------") print("Choisissez parmi les 3options suivantes :") print("1: Ajouter un élément à la liste.") print("2: Afficher la liste.") print("3: Quitter.") #test entrée est bien un chiffre while True: try: choix=int(input("Votre choix ?")) break except ValueError : print("Erreur, votre choix doit etre un nombre!") #test du nombre entré et option exécutée while choix in liste_choix: if choix == 1 : print("Choix 1, ajouter un élément") ajouter=input("Votre ajout ?") liste_elements.append(ajouter) break if choix == 2 : print("Choix 2, Afficher la liste") print(liste_elements) break if choix == 3: print("Choix 3 , Quitter") break Je cherche a quitter le premier while ( le menu )uniquement si j ai fin toutes les opérarions et pressant la touche 3 merci de votre aide pour un retraité curieux, l identation n 'est pas visibl dans mon message malgré sa perésence lors de la composition