Select random element from a list - Python
import random
items = [1, 2, 3, 4, 5, 6, 7, 8, 9]
random_item = random.choice(items)
print(random_item)
Recent Posts
- Solve "ValueError invalid literal for int() with base 10" - Python
- Handling dynamic subdomain with Flask - Python
- A minimal example about WordPress object cache
- Write our first Selenium program with Python 3 & Firefox
- Install Geckodriver in Ubuntu & its variants
Your Questions / Comments
If you found this article interesting, found errors, or just want to discuss about it, please get in touch.