excusez svp aider moi ça dit: écrivez une fonction qui vous renvoie une liste de mots comprenant 4 lettres.
Informatique
yoplait32
Question
excusez svp aider moi ça dit: écrivez une fonction qui vous renvoie une liste de mots comprenant 4 lettres.
1 Réponse
-
1. Réponse caylus
Réponse :
Bonjour,
Explications :
import random
def makeMot(nb=10,nl=4):
return [ "".join( ["ABCDEFGHIJKLMNOPQRSTUVWXYZ"[random.randint(1,nb) -1] for j in range(nl) ]) for i in range(nb)]
liste_de_mots=makeMot(3,4)
print (liste_de_mots)