I wan an array which is going to have about 30 things in it. Each thing in the array is going to be a set of variables, and depending on which thing in the array is chosen, different variables will be set.
e.g.
foo = ['fish', 'mammal', 'bird']
ranfoo = random.randint(0,2)
animal = foo[ranfoo]
this works fine for returning a random element from the list, but how then, depending on the item selected do I assign some variables to them?.
e.g. 'bird' has been randomly selected, I want to assign : flight = yes swim = no. Or something along those lines... What I'm programming is a little more complicated but that's basically it. I've tried this:
def thing(fish):
flight = no
swim = yes
def thing(mammal):
flight = no
swim = yes
def thing(bird):
flight = yes
swim = no
foo = ['fish', 'mammal', 'bird']
ranfoo = random.randint(0,2)
animal = foo[ranfoo]
thing(animal)
But that doesn't work either and I don't know what else to do... Help???