Nov-12-2018, 12:47 AM
(This post was last modified: Nov-12-2018, 01:39 AM by ichabod801.)
Hi, I'm practicing coding using python and I'm working with this small project of mine. Im having issue running or calling the function into if else.
Target :
I want to generate a random between 0-900 and define a range,
if 0-300 then its 1 that represent rock, 301-600 is paper and 601-900 is scissors.. then player will select 1-3 for (rock paper scissors) if it matches tie. Thanks
Heres my code:
Thanks
Target :
I want to generate a random between 0-900 and define a range,
if 0-300 then its 1 that represent rock, 301-600 is paper and 601-900 is scissors.. then player will select 1-3 for (rock paper scissors) if it matches tie. Thanks
Heres my code:
print ("Welcome to RPS GAME, Winning rules as follows: \n"
+"Rock vs Paper = Paper Wins \n"
+"Paper vs Scissor = Scissor Wins \n"
+"Scissor vs Rock = Rock Wins \n" )
#CPU Random
cpurange = range(300)
cpu = random.choice(cpurange)
def getvalue(cpu):
if cpu <= 300:
getvalue = 1
#Human will select
human = int(input ("Pick 0-Rock, 1-Paper, 2-Scissors?: "))
if human == 1 and getvalue == 1:
print ("TIE")
print ("##### RESULT ##### \n"
+"Human: {}".format(human))Result is not working if thinking if I properly calling the def getvalue function into below if/else statement.Thanks
