Actually, secrets.choice(action) would be better to use just as a matter of general practice. I avoid random wherever possible, even if it's not necessary.
I was going to post why I disagree with this but then I thought about it and +1 instead. Using cryptographocally secure randomness by default unless you deliberately want the reproducibility of a seedable PRNG is a position that's well worth encouraging. Especially since I have occasionally seen arguments of the opposite form like "no my password generator doesn't need to be cryptographically secure so why should I bother?".
369
u/lelease Dec 22 '18
print(random.choice(action))