Python - Random Choice - How to Pick a Random Element With One Line of Code

Опубликовано: 03 Октябрь 2024
на канале: codevev
1,195
37

#Shorts #Python
We may often want to get a random item from a collection of elements. Python excels at this because we don't have to implement anything from scratch and just use the built-in "choice" function in the "random" module.
The result? It only takes us ONE LINE to pick a random item!

-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter:   / evgenyurubkov  
Instagram:   / evgenyurubkov  
Youtube:    / @codevev