Skip to content
← Back to Community
Need a rock paper scissors code asap!
Profile icon
bellabonura21

In this unit, you expanded your Python skills, and now you can really have some fun! In this lab, you are going to create a game that allows the user to play Rock, Paper, Scissors against the computer. If you aren’t familiar with this classic game, here’s how it works: two people (or a person and a computer!) each select either rock, paper, or scissors. The player who chooses the stronger object wins. Here is how the winner is determined:

Rock beats scissors because a rock can break scissors.
Paper beats rock because paper can cover a rock.
Scissors beats paper because scissors can cut paper.

Your program should do the following:

Randomly choose rock, paper, or scissors for the computer
Ask the user to choose rock, paper, or scissors
Compare the computer’s choice to the player’s choice
Announce whether the computer or the human won

PLEASE DO IT ASAP!!! I HAVE TRIED FOR SOOOOO LONG!!! HELP!

Answered by RYANTADIPARTHI [earned 5 cycles]
View Answer
Voters
Profile icon
FaizaanHafeez
Profile icon
ChrisB06
Profile icon
IssabelleWillia
Profile icon
zmalik8
Profile icon
Lik-Hang-AlexHa
Profile icon
bellabonura21
Comments
hotnewtop
Profile icon
bellabonura21

yes your link did work. thanks! I just still need help with actually putting it on the code..

Profile icon
Coder100

yay! send repl @bellabonura21

Profile icon
RYANTADIPARTHI

@bellabonura21 sure, can you show me your code?

Profile icon
bellabonura21

@RYANTADIPARTHI
thanks so much!

Profile icon
RYANTADIPARTHI

@bellabonura21 no problem :)

Profile icon
RYANTADIPARTHI
Profile icon
bellabonura21

thanks yall! i hoeslt could not do this without you guys! c-ya!

Profile icon
bellabonura21
Profile icon
Kookiez

what have you done yet? pls send repl or something, also is this a homework/classwork assignment?

Profile icon
bellabonura21

that did not work either :( im sorry... i just cant do it!

Profile icon
RYANTADIPARTHI

@bellabonura21 did my link work?

Profile icon
JBloves27

Well, you could do the following:

import random print("rock paper scissors") stuff=["rock","paper","scissors"] while True: Input = input("input rock, paper, or scissors ") cp = random.choice(stuff) if cp == 'rock' and Input == 'paper': print("you won") elif cp == 'paper' and Input == 'scissors': print("you won") elif cp == 'scissors' and Input == 'rock': print('you won') elif cp == 'scissors' and Input == 'paper': print('you lost') elif cp == 'paper' and Input == 'rock': print('you lost') elif cp == 'rock' and Input == 'scissors': print('you lost') else: print("its a tie")

That should work, and you can add additional stuff as well

Profile icon
bellabonura21

did not work :( thx tho

Profile icon
Coder100
import random print('rock paper scissors!') choices = ['rock', 'paper', 'scissors'] choice = input('ur choice') computer = 'rock' computer = random.choice(choices) if computer == 'rock' and choice == 'paper': print("you win!") elif computer == 'paper' and choice == 'scissors': print("you win!") elif computer == 'scissors' and choice == 'rock': print("you win!") elif computer == 'paper' and choice == 'rock': print("you lose!") elif computer == 'scissors' and choice == 'paper': print("you lose!") elif computer == 'rock' and choice == 'scissors': print("you lose!") else: print("tie")

so like simply, all you need to do is check if the computer is like something, and the user choice is defeats computer, then the user wins, and if you see that it is the other way around, evidently the computer wins. At the end, it must be a tie.

working repl: https://repl.it/@Coder100/asd-asdfad-dsfads-ads-fd-asdf-dsafsad-working-tik-tak-toe#main.py

Profile icon
bellabonura21

just help pls

Profile icon
Coder100

well what have you tried lol