Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

How to make a random selection from a list in Python?

I am trying to make Rock Paper Scissors but every time the computer is supposed to make a random selection it picks the same one over and over. How do I make it 100% random?

2 years ago

Voters

MironAnanyev
MironAnanyev

Comments

TopNew
1
TheForArkLD
TheForArkLD
import math import random choice[math.floor(random.random() * len(choice))]
2 years ago
1
TheForArkLD
TheForArkLD

@TheForArkLD
if it solved your problem then, push check mark please.

2 years ago
1
octopyBot
octopyBot

'''
import random
responses = ['rock', 'paper', 'scissors']
rps = random.choice(responses)
'''

2 years ago
1
ironblockhd
ironblockhd

It works fine for me
IMG_2817

2 years ago
1

@ironblockhd
do it again, it always chooses rock

2 years ago
Load more