How can you randomly return an element from a list? "rand()" is uniformly distributed from 0to 1. "list" is a list of elements.* | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can you randomly return an element from a list? "rand()" is uniformly distributed from 0to 1. "list" is a list of elements.*

options are : A. return list[int(len(list)*rand())] B. return list[len(list)/rand()] C. return list[int(rand())] D. return list[len(list)]  

10th Nov 2018, 7:09 PM
Deep
Deep - avatar
14 Answers
0
Use randint(start,end)
10th Nov 2018, 7:13 PM
Felix
Felix - avatar
0
which is the correct option +felix
10th Nov 2018, 7:15 PM
Deep
Deep - avatar
0
?
10th Nov 2018, 7:15 PM
Deep
Deep - avatar
0
Must be A
10th Nov 2018, 7:16 PM
Felix
Felix - avatar
0
Are you presenting a challenge riddle? Because this is not the place for it.
10th Nov 2018, 9:51 PM
HonFu
HonFu - avatar
0
HonFu my initial thought was similar but I think it's homework There are three diff threads
10th Nov 2018, 9:53 PM
Roneel
Roneel - avatar
0
then where to post ?
11th Nov 2018, 7:44 AM
Deep
Deep - avatar
0
Roneel page not found
11th Nov 2018, 7:47 AM
Deep
Deep - avatar
0
Are you using iOS app or web(desktop) version? This is only for android app.
11th Nov 2018, 7:48 AM
Roneel
Roneel - avatar
0
android obviously
11th Nov 2018, 7:49 AM
Deep
Deep - avatar
0
Have you downloaded the app? If not, download.
11th Nov 2018, 7:51 AM
Roneel
Roneel - avatar
0
cut the crap & tell do you know the solution of the question I posted?
11th Nov 2018, 7:53 AM
Deep
Deep - avatar
0
A) obviously Anyway, I am sure but mods will mfd this thread.
11th Nov 2018, 7:56 AM
Roneel
Roneel - avatar