Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: fr.comp.lang.python Subject: Re: Tricher au scrabble... Date: 28 Nov 2023 16:19:20 GMT Organization: Stefan Ram Lines: 25 Expires: 1 Dec 2024 11:59:58 GMT Message-ID: References: <65660fc0$0$6447$426a34cc@news.free.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Ui/eO+YuWFMfrDpEu9xKhA64cZzYQHkdv9N87AuIgdAudu Cancel-Lock: sha1:Qo3mmV5+2kgx+VQYMRbtCU6ls6g= sha256:5x6Oygppdjgi021K9bXUIOxlMf03iUlEIDyvh2ViAw0= X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: fr-FR Accept-Language: de-DE-1901, en-US, it, fr-FR Bytes: 2157 yves writes: >En entrée : >dico.txt : > >pomme >fraise >orange > >En sortie : >le dictionnaire scrabble : > >{'emmop': 'pomme', 'aefirs': 'fraise', 'aegnor': 'orange'} C'est vraiment très clair ! (Cependant, les exemples ne rendent pas toujours les tâches claires. Ainsi, "Entrée 2, Sortie 4", pourrait être compris comme x+x, x*2, x+2, x*x, ou autre.) Pour aller de l'entrée à la sortie, on pourrait par exemple utiliser quelque chose comme dans le petit script suivant. dico = 'pomme', 'fraise', 'orange' scrd ={ ''.join( sorted( mot )) : mot for mot in dico } print( scrd )