How do I randomly select from a list in Python?
- by Liam Block
Basically, I've got a homework task of programming a text based battle simulator in Python. Obviously I've gone with pokémon...
I would like the enemy to be randomly selected, however I don't know how to randomly select from a list...
foo = ['a', 'b', 'c', 'd', 'e']
from random import choice
print choice(foo)
This is what I've been told to try but I've got no modules or anything imported...
How can I make this work,
appreciated.