Useful method "random.choice"
In case of choosing an element in a list randomly, I usually write a code like below.
Ruby:
ary = [1, 2, 3, 4, 5] print ary[rand(0...ary.length)]
But in python, an useful method exists.
import random ary = [1, 2, 3, 4, 5] print(random.choice(ary)) #=> random element
Actually, Ruby also has such a useful method.
ary = [1, 2, 3, 4, 5] print ary.sample #=> random element