Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > fr.comp.lang.python > #3370
| Newsgroups | fr.comp.lang.python |
|---|---|
| Subject | Pourquoi ca ne marche pas |
| From | vdperic <nospam_vdperic@yahoo.fr.invalid> |
| Organization | !No_Organization! |
| Message-ID | <KZWdnRtmc8WAsjXCnZ2dnUU798zNnZ2d@giganews.com> (permalink) |
| Date | 2020-11-08 11:47 -0600 |
Bonjour,
Je commence à m'intéresser à Python. Je suis le livre Apprendre la programmation
par le jeu. Pourquoi ceci fonctionne
from tkinter import *
import random
def melangemot(mot) :
melange = mot
for i in range(len(mot)) :
a = random.randint(0,len(mot)-1)
b = random.randint(0,len(mot)-1)
new = ""
for j in range(len(melange)) :
if j==a :
new = new + melange[b]
elif j==b :
new = new + melange[a]
else :
new = new + melange[j]
melange = new
return melange
def verif():
if E.get().upper() == m :
L.config(text="Gagné !")
else :
B.config(text="Non, réessayer ?")
fen = Tk()
fen.geometry("200x100")
fen.title("Mots mélangés")
m="Maison"
L=Label(fen,text=melangemot(m),width=20)
L.place(x=20,y=10)
E=Entry(fen,width=24)
E.place(x=20,y=30)
B=Button(fen,text="Valider",font='arial 9',width=20,command=verif)
B.place(x=20,y=60)
B.focus()
fen.mainloop()
mais quand je mets
m=input("Choisissez un mot:")
ça ne marche plus.
Pouvez-vous m'expliquer ? Je vous en remercice
Back to fr.comp.lang.python | Previous | Next — Next in thread | Find similar
Pourquoi ca ne marche pas vdperic <nospam_vdperic@yahoo.fr.invalid> - 2020-11-08 11:47 -0600
Re: Pourquoi ca ne marche pas Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2020-11-08 21:08 +0100
Re: Pourquoi ca ne marche pas vdperic <nospam_vdperic@yahoo.fr.invalid> - 2020-11-09 12:08 -0600
Re: Pourquoi ca ne marche pas Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2020-11-09 19:58 +0100
Re: Pourquoi ca ne marche pas vdperic <nospam_vdperic@yahoo.fr.invalid> - 2020-11-10 04:08 -0600
Re: Pourquoi ca ne marche pas Benoit Izac <use.reply.to@INVALID.ADDRESS> - 2020-11-10 13:34 +0100
csiph-web