Which of the following methods of 'random' module is used to pick a single element, randomly, from a given list of elements?
a. choose
b. choice
c. sample
d. pick
Answers
Answered by
6
HI there,
In order to pick a single element, randomly, from a given list of elements, sample method is used.
Therefore, in the above question. Option C: Sample is the correct option.
I hope you are satisfied.
Thanks.
Answered by
6
Answer:
b) choice
Explanation:
In order to pick a single element, randomly, from a given list of elements, choice method is used.
sample is used to pick more than one item from a list
Therefore, in the above question. Option b choice is the correct option.
Refer to the below article for more detail
https://pynative.com/python-random-choice/
Similar questions