Answers for "python how to randomly choose an item from a list"

2

python how to randomly choose an item from a list

import random

nums = ['a', 'b', 'c', 'd', 'e']
print(random.choice(nums))
Posted by: Guest on January-16-2021

Code answers related to "python how to randomly choose an item from a list"

Python Answers by Framework

Browse Popular Code Answers by Language