0
Taking a random number from list.
Hello world! I have a list with number from 1-100. How can i take a random number from that list.
3 Answers
+ 5
import random
print(random.choice(arr))
You have to use this
random.choice()
+ 3
you can also use the normal random.randint as well by doing it this way
import random
arr = [1, 2, 3]
print(arr[random.randint(0, len(arr)-1)])
0
Md Sayed š§š©š§š© thank u