0
How do you return a random result from a list in python?
If you had: Words = ["yes","no","maybe"] How would you?
12 Answers
+ 4
In Python do:
import random
Words = ["yes", "no", "maybe"]
print(random.choice(Words))
+ 3
what language is this?
JavaScript?
if so
https://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array
+ 2
Paul Grasser yeah i deleted my comment, i thought he wanted to sort the array randomly, thx
+ 2
Thank you Paul Grasser
+ 1
á á brains I think he wanted to select a random element from the list. For this random.choice is better.
+ 1
Oh do @ their name (but no space)
0
sorry
0
it's in Python
0
Yes that is right
0
The shuffle thing is also very helpful thx
0
By the way, how do you make a hyperlink to another profile like both Paul grasser and brains did?
0
Thx