I'm trying to have certain strings print out depending on which dice roll is made.
I have tried making lists for what rolls get which event, but even at that no event prints out only what i have rolled.
import random
def dice_roll():
d20_roll = random.randint(1,20)
print("You rolled " +str(d20_roll))
def dice_choice():
event = str(d20_roll)
bad_list = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
'11', '12']
good_list = ['13', '14', '15', '16', '17', '18']
gag_list = ['19', '20']
if event == bad_list:
print('bad_list stuff')
elif event == good_list:
print('good_list stuff')
else:
if event == print gag_list:
print("gag_list stuff")
dice_choice()
dice_roll()
I expect the output to be any of the three options the random roll will make. What I receive is just the result of the dice_roll itself, without the choice.
Aucun commentaire:
Enregistrer un commentaire