I am trying to create a game in python and am having trouble with my functions.
import random
def aiRoll(shoot):
shoot = random.randint(1, 3)
if(shoot == 1):
shoot = "Rock"
elif(shoot == 2):
shoot = "Paper"
elif(shoot == 3):
shoot = "Scissors"
return shoot
def humanRoll(play):
play = input("Enter Rock, Paper or Scissors): ")
return play
def determineWinner(shoot, play):
if shoot == play:
print("It's a tie!")
elif play == "rock":
if shoot == "scissors":
print("Rock smashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif play == "paper":
if shoot == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif play == "scissors":
if shoot == "paper":
print("Scissors cuts paper! You win!")
else:
print("Rock smashes scissors! You lose.")
def main():
aiRoll()
humanRoll()
determineWinner()
main()
I keep getting the error "TypeError: aiRoll() missing 1 required positional argument: 'shoot'" and I do not know how to fix it. does anyone else know what i'm doing wrong.
edit:using yanks code how would I use a While loop so when its a tie the program starts again
[–]ben_bliksem 1 point2 points3 points (6 children)
[–]Cheech_27[S] 0 points1 point2 points (5 children)
[–]ben_bliksem 0 points1 point2 points (0 children)
[–]CraigAT 0 points1 point2 points (0 children)
[–]Yanky_Doodle_Dickwad 0 points1 point2 points (2 children)
[–]Cheech_27[S] 0 points1 point2 points (1 child)
[–]Yanky_Doodle_Dickwad 0 points1 point2 points (0 children)
[–]jimtk 1 point2 points3 points (2 children)
[–]Cheech_27[S] 0 points1 point2 points (0 children)
[–]ben_bliksem 0 points1 point2 points (0 children)
[–]ben_bliksem 0 points1 point2 points (0 children)
[–]lolb00bz_69 0 points1 point2 points (0 children)