Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > fr.comp.lang.python > #3749

Re: Très très débutant - merci pour l'aide

From Benoit Izac <use.reply.to@INVALID.ADDRESS>
Newsgroups fr.comp.lang.python
Subject Re: Très très débutant - merci pour l'aide
Date 2022-02-05 20:56 +0100
Message-ID <87v8xt5bpe.fsf@izac.org> (permalink)
References <QeydndQb0pPbC2P8nZ2dnUU7_83NnZ2d@giganews.com>

Show all headers | View raw


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

Back to fr.comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Tr�s tr�s d�butant - merci pour l'aide DeMonteRobert <nospam_r.demonte69@gmail.com.invalid> - 2022-02-05 09:22 -0600
  Re: Très très débutant - merci pour l'aide Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2022-02-05 20:56 +0100
    Re: Très très débutant - merci pour l'aide Lulu <lulu042@fry.fr.invalid> - 2022-04-07 22:53 +0200
      Re: Très très débutant - merci pour l'aide Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2022-04-08 12:52 +0200

csiph-web