'rock paper scissor python program input error

import random

def rpc(): a = ["rock", "paper", "scissor"]

b = random.choice(a)

print(b)

userinput = input('please type rock, paper or scissor:')
if userinput == "":
    print("please print the right thing")
    rpc()

if userinput != "rock":
    print("type the right thing!")
    rpc()

if userinput != "paper":
    print("type the right thing!")
    rpc()

if userinput != "scissor":
    print("type the right thing!")
    rpc()


while b == userinput:
    print("it is a draw, do you want to play another one?")
    c = input("type 'y' if you want to play one more time or press 'n': ")
    if c == 'y':
        rpc()
    elif c =='n':
        break
    else:
        print("print the right words please")

if b == 'rock' and userinput == 'paper':
    print("you win!")
    rpc()

elif b == 'rock' and userinput == 'scissor':
    print("you lost")
    rpc()

elif b == 'paper' and userinput == 'scissor':
    print("you win!")
    rpc()

elif b == 'paper' and userinput == 'rock':
    print("you lost!")
    rpc()

elif b == 'scissor' and userinput == 'rock':
    print("you win!")
    rpc()

elif b == 'scissor' and userinput == 'paper':
    print("you lost!")
    rpc()

rpc()

this is my code for rock paper and scissor, its pretty simple but when i run my code and input my rock paper and scissor, i get my please print the right thing statement, i have no idea why its happening, any help would be wonderful, thank you!



Solution 1:[1]

Lets clean this up....

userinput = input('please type rock, paper or scissor:')
while userinput not in acceptable_inputs:
    userinput = input('please type rock, paper or scissor:')
opponents_choice = random.choice(objects)
# Check and print. Loop to keep playing - 2 out of 3 wins....

Solution 2:[2]

import random
def winner(riya,siya):
    if (riya==siya):
        return None
    elif (riya=="s"):
        if (siya=="p"):
            return False
        elif(siya=="k"):
            return True
    elif (riya=="p"):
        if (siya=="s"):
            return False
        elif (siya=="k"):
            return True
    elif (riya=="k"):
        if (siya=="s"):
            return True
        elif (siya=="p"):
            return False
        
print("riya pick: stone(s) paper(p) sessior(k)") 
a= random.randint(1,3) 
if a==1:
    riya="s"
elif a==2:
    riya="p" 
elif a==3:
    riya="k"
siya=input(" siya pick: stone(s) paper(p) sessior(k)")
b=winner(riya,siya)
print(f"riya pick{riya}")
print(f"siya pick {siya}")
if b==None:
    print("tie")
elif b:
    print("winner")`enter code here`
else:enter code here
    print("loose")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pythonista
Solution 2 tushar varun