mardi 26 septembre 2017

How to check if something printed using random module is repeated?

This is my code so far:

import random

words = ['a', 'b', 'c']
def abc():
    print(random.choice(words))
    input('Press Enter to Continue')
    abc()
abc()

How can I make it so every time it prints a word from the list words, it checks if it has been repeated before? I would prefer the answer being either in python without modules or with the random module.




Aucun commentaire:

Enregistrer un commentaire