lundi 9 décembre 2019

Generating list of a random word, random number of times

How do I generate a list that will contain only the type of monster randomly chosen in choice a random number of times (1-5)?

monsters = ("trolls", "ogres", "werewolves", "dragons")
choice = random.choice(monsters)

I have tried the following which delivers the number but how do I make a list out of it?

num = random.randint(1, 5)
print("Your hero must fight against: ", num, choice)



Aucun commentaire:

Enregistrer un commentaire