mercredi 11 février 2015

Why can't I store a number in a list and use that number to lead to a "choice"?

So this is one of my first ever (by myself) programs i've created. I'm stuck on a certain part though, not going to list the whole script, just the part i'm stuck on.:



import random
roll_dice = random.randint(0,11)
Player_Number = []

def char_creation():
ROLL = ("YOU ROLLED A %d !" % roll_dice)
Player_Number.append(ROLL)


def player_choices(char_creation):
if Player_Number == 0:
print ("Your character is Super Man!")
elif Player_Number == 1:
print ("Your character is Bat Man!")

(Not going to continue listing choices)



char_creation()
player_choices(char_creation)


Basically this is what i'm having problems with. And understanding. I can't roll a random number, store it in a list, and have the number choose a choice based on that number? Sorry, i'm really new to programming. Any tips would be appreciated!


Aucun commentaire:

Enregistrer un commentaire