Deutsch   English   Français   Italiano  
<87v8xt5bpe.fsf@izac.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!pasdenom.info!news.izac.org!reader
From: Benoit Izac <use.reply.to@INVALID.ADDRESS>
Newsgroups: fr.comp.lang.python
Subject: Re: =?utf-8?B?VHLDqHMgdHLDqHMgZMOpYnV0YW50?= - merci pour l'aide
Date: Sat, 05 Feb 2022 20:56:45 +0100
Message-ID: <87v8xt5bpe.fsf@izac.org>
References: <QeydndQb0pPbC2P8nZ2dnUU7_83NnZ2d@giganews.com>
Reply-To: benoit.izac@free.fr
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: keg.izac.org;
	logging-data="2180646"; mail-complaints-to="usenet@izac.org"
Bytes: 2146
Lines: 42

Bonjour,

Le 05/02/2022 à 16:22, DeMonteRobert a écrit dans le message
<QeydndQb0pPbC2P8nZ2dnUU7_83NnZ2d@giganews.com> :

> voila mon premier codage et une erreur apparait.... je trouve pas pourquoi ?
> Pouvez m'aidez svp merci...
>
> code:
> # Manoir hanté
> from random import randint
> print ('le manoir hanté')
> Je_suis_courageux = True
> score = 0
> while Je_suis_courageux :
>                porte_fantôme = randint (1, 3)
>                print ('Tu te retrouves face à trois portes...')
>                print ('Derriere laquelle se cache le fantome ?')
>                print ('Quelle porte ouvres -tu ?')
>                print = input ('1, 2 ou 3 ?')

Là, tu viens de redéfinir la fonction print… Tu ne peux plus l'utiliser
ensuite comme avant puisque l'identifiant pointe sur une chaîne de caractère.

>                num_porte = input ('1, 2 ou 3? ')
>                if num_porte == porte_fantôme:
>                          print ('UN FANTOME !')

Boum (TypeError: 'str' object is not callable) !

>                          Je_suis_courageux = False
>                else:
>                     print ('Pas de fantôme!')

Boum (TypeError: 'str' object is not callable) !

>                     print ('tu entres dans la prochaine salle.')
>                     score = score + 1
> print ('Au secours !')
> print ('Partie terminée ! Ton score :', score)

-- 
Benoit Izac