Random.choice() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Random.choice()

Hello, I am making a Rock Paper Scissors game and need to put a random.choice() function, I’m not getting how to use it help!

8th Sep 2018, 3:00 PM
Rachel Barbosa
Rachel Barbosa - avatar
2 Answers
+ 10
# Pass a list of possible options into it: import random options = ["Rock", "Paper", "Scissors"] for _ in range(10): print(random.choice(options))
8th Sep 2018, 3:03 PM
Burey
Burey - avatar
8th Sep 2018, 3:04 PM
Steven M
Steven M - avatar