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()

Shouldn't you call both main() and the find_number? def main() has no print function, and the def find_number is what you used for printing.
I hope that helps, I'm new to Python myself.
And the extra prints as shown below with the @ beside them aren't necessary.

#
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@

This works for me:

import random
import os

def main ():

    #declare variables
    compNumber = 0
    playNumber = 0
    tie = 0

    playGame = findWinner(compNumber, playNumber, tie)
    os.system("pause")



def findWinner(compNumber, playNumber, tie):

    compNumber = random.randint(1, 3)
    print "Player1, please select your choice."
    playNumber = int(raw_input('1 for Rock, 2 for Paper, or 3 for Scissors: '))
    print "The computer chose: ", compNumber

    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()

I think I changed something else, but the main thing I noticed is line 20 in my above code. I added int() around the raw_input() to make sure that it converted to int. That was probably it.

@SgtMe

Thank you!!!! That was it!

Please upvote my post seeing as it helped :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.