Ask coding questions

← Back to all posts
please help i cant get the rock paper scissor thing to work it doesnt do what i want it to do
frogcookies (0)

if you have time could you please check the code. i checked it and found out only these 2 dont want to work

if rocks == ("scissors"):
if computer == ("paper"):
print (" I CHOOSE PAPER \n \n oh you won \n which means you
are smart")

if rocks == ("paper"):
if computer == ("scissors"):
print ("I CHOOSE SCISSORS \n \n you lost \n which means you
are dumb")

Comments
hotnewtop
Coder100 (17026)

Yeah... you have a few logic errors, here's the correct code:

from random import choice
objects = ["rock", "paper" , "scissors"]         
computer = choice(objects)                    
rocks = input("what will you chooose? Rock, Paper,or Scissors \n ").lower().strip()
if rocks == ("rock") and computer == ("scissors"):
    print (" I CHOOSE SCISSORS \n \n oh you won \n which means you are smart")
elif rocks == ("scissors") and computer == ("paper"):
   print (" I CHOOSE PAPER \n \n oh you won \n which means you are smart")
elif rocks == ("paper") and computer == ("rock"):
    print (" I CHOOSE ROCK \n \n oh you won \n which means you are smart:")
elif rocks == ("rock") and computer == ("paper"):
    print ("I CHOOSE PAPER \n \n you lost \n which means you are dumb!")
elif rocks == ("paper") and computer == ("scissors"):
    print ("I CHOOSE SCISSORS \n \n you lost \n which means you are dumb")
elif rocks == ("scissors") and computer == ("rock"):
    print ("I CHOOSE ROCK \n \n you lost \n which means you are dumb")
else:
    print ("tie")
RishabhRanjit (6)

I don't understand this at all.....

This code is very messy.

If you need help, you should clean it up...