I am trying to create a program that creates a character by randomly assigning it a race, class, and stats.
However I want each stat to have a unique value. So if strength
is 8, then none of the other stats can be 8. How would I go about doing this? Do I need to delete list entries as choices are made?
My code
import random
races = ["Human", "Dwarf", "Elf"]
classes = ["Fighter", "Wizard", "Rogue"]
stats = [8, 10, 11, 12, 14, 15]
Strength = 0
Dexterity = 0
Constution = 0
Intelligence = 0
Wisdom = 0
Charisma = 0
Strength = random.choice(stats)
Dexterity = random.choice(stats)
Constution = random.choice(stats)
Intelligence = random.choice(stats)
Wisdom = random.choice(stats)
Charisma = random.choice(stats)
race = random.choice(races)
clse = random.choice(classes)
Aucun commentaire:
Enregistrer un commentaire