Nov-12-2018, 02:17 AM
@ichabod801, Thanks for your reply.
Standard procedure of posting of codes is noted.
1. While the given command works, But I would like to if to define the function is we need to create a variable "computer"? (Will research about funnction tho.)
2. random.randint(1, 3) - I this case its 1 to 3 only but i need 0 - 900 then I divide it to 3 for 3 choices (rock,paper,scissor). Should I use (1,900)?
3.
Tried using this, but completely blind on what will is use to get the range of 300 to 600 and assign a value of 2.. Checking on conjunction operator
Standard procedure of posting of codes is noted.
1. While the given command works, But I would like to if to define the function is we need to create a variable "computer"? (Will research about funnction tho.)
2. random.randint(1, 3) - I this case its 1 to 3 only but i need 0 - 900 then I divide it to 3 for 3 choices (rock,paper,scissor). Should I use (1,900)?
3.
def getvalue(cpu): if cpu <= 300: value = 1 elif cpu == range(301,600): value = 2 return value computer = getvalue(cpu) if human == 1 and computer == 1: print ("TIE-ROCK") elif human == 2 and computer == 2: print ("TIE-PAPER")Currently its not working when more than 300 as stated above.
Tried using this, but completely blind on what will is use to get the range of 300 to 600 and assign a value of 2.. Checking on conjunction operator
#CPU Random rndm = random.randint(301,600) def getvalue(rndm): if rndm <= 300: value = 1 elif rndm >=301 and <=600: value = 2 elif rndm <= 601: value = 3 return value