lundi 19 décembre 2016

Can I set condition for the random.randint() function in python

WORDS=("lorem","ipsum","python")
words = random.choice(WORDS)
correct = words
length = 0
while length <len(words):
    i = random.randint(0,len(words))
    print(words[i],end=" ")
    length +=1

I am trying to make a word jumble game, where letters in a word are supposed to mash up. I wanted to ask if I can set a condition so that the ido not repeat the same value over and over again

Any help is appreciated.




Aucun commentaire:

Enregistrer un commentaire