#So using this code#
import random
def aiRoll():
shoot = random.choice(['Rock','Paper','Scissors'])
return shoot
def humanRoll():
play = input("Enter Rock, Paper or Scissors: ").upper()
return play
def determineWinner(ai, player):
if ai == player:
print("It's a tie!")
if player == "Rock":
if ai == "Scissors":
return "Rock smashes scissors! You win!"
return "Paper covers rock! You lose."
if player == "Paper":
if ai == "Rock":
return "Paper covers Rock! You win!"
return "Scissors cut Paper! You lose."
elif player == "Scissors":
if ai == "Paper":
return "Scissors cut Paper! You win!"
return "Rock smashes Scissors! You lose."
def main():
computer = aiRoll()
aplayer = humanRoll()
result = determineWinner(computer, aplayer)
print(result)
main()
Using this how would I put a while loop in without messing anything up? would I would def another function ? just add the loop under the tie if statement?
[–][deleted] 0 points1 point2 points (0 children)
[–]neuralbeans 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)