Skip to content

Facing Problem in Executing Rock , papers , scissors game . need help in python #11

@Laksh-Devloper

Description

@Laksh-Devloper

`
'''This code is not giving error but i dont know why the "comp" value is always none. its not changing even through random module and its functions . please help me
'''
import random

def game(comp , player):
if player == comp:
return None
elif comp == "r":
if player == "s":
return False
elif player == "p":
return True
elif comp == "s":
if player == "p":
return False
elif player == "r":
return True
elif comp == "p":
if player == "r":
return False
elif player == "s":
return True

comp = print("Comp Turn: Rock , Papers, Scissors: ")
randNo = random.randint(1 , 3)
if randNo == 1:
comp == "r"
elif randNo == 2:
comp == "p"
elif randNo == 3:
comp == "s"

player = input("Your Turn: Rock(r) , Papers(p) , Scissors(s) : ")

result = game( comp , player)

print("Computer chose" , comp)
print("You chose`" , player)

if result == None:
print("The game is tied")
elif result:
print("You Won")
else:
print("You Lose")

'''
the "comp" value is showing none type, i want it to be str. i tried converting it but it not worked plzzz help masters. anyone professional here to help`'''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions