Could use some advice, as always it's greatly appreciated. I know I could have ripped this code off from anywhere but I'm really trying to learn this the right way.
Not sure what I am doing wrong here to make my If Elif part of function not work correctly. It doesn't print the winner results at all.
This code is only partially functional, I know. I still have to build a while loop to check for a tie and force the user to play again until a winner is determined. I'm not entirely sure my logic is leading me down the right road for that though.
Any help is appreciated. is it something with the identation?
import random
def main ():
#declare variables
compNumber = 0
playNumber = 0
tie = 0
playGame = findWinner(compNumber, playNumber, tie)
def findWinner(compNumber, playNumber, tie):
compNumber = random.randint(1, 3)
print
print "Player1, please select your choice."
print
playNumber = raw_input('1 for Rock, 2 for Paper, or 3 for Scissors: ')
print
print "The computer chose: ", compNumber
print
if compNumber == 1 and playNumber == 3:
print "Computer wins - Rock smashes scissors!"
tie = 0
elif compNumber == 1 and playNumber == 2:
print "Player1 wins - Paper covers rock!"
tie = 0
elif compNumber == 2 and playNumber == 1:
print "Computer wins - Paper covers rock!"
tie = 0
elif compNumber == 2 and playNumber == 3:
print "Player1 wins - Scissors cut paper!"
tie = 0
elif compNumber == 3 and playNumber == 1:
print "Player1 wins - Rock smashes scissors!"
tie = 0
elif compNumber == 3 and playNumber == 2:
print "Computer wins - Scissors cut paper!"
tie = 0
elif compNumber == playNumber:
print "TIE - You must keep playing for a winner!"
tie = 1
return tie
#calls main
main()