Python Forum

Full Version: coding a loot generator
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everybody,

I play rpg game and i want to make a loot generator
I write this, i want when i random "parchemins" i import random for a new liste.
Someone can help me ? thanks

import random
liste = ['potion','objet magique','flèches','parchemins']
tresors = random.choice(liste)
print (tresors)

if 'parchemins' in tresors:
   print ("Dark_alchemy")
Dark_alchemy = 1
Explain some more what you want to do!

Tu veux faire quoi?

Do you want to create a new list?

import random
liste = ['potion','objet magique','flèches','parchemins', 'Emmanuel Jean-Michel Frédéric Macron']

# loop through many random.choice(liste)
for i in range(0, 20):
    tresors = random.choice(liste)
    if 'Emmanuel' in tresors:
       print ("The Great Wizard cometh!")