+ 2
How to get more than one random choice from a list.
4 Respostas
+ 2
Amit Kumar
Random has a specific method for this type of stuff. It is called sample() to choose from a specified population.
Demo:
import random
a = [*range(11)]
b = random.sample(a,3)
print(b)
Output: You get 3 random numbers between the range of 1 and 10.
Happy Coding 😀
+ 1
What is k?
+ 1
Amit Kumar k represents how many times to take a random item from a list.
+ 1
Ohh okk thank you