after making error doing recursion none.
def getplayerinput(): = ["rock","paper","scissors"] plin = raw_input("choose %s/%s/%s: " %(a[0], a[1], a[2])) print plin,'-first print' if plin not in a: print "wrong input" getplayerinput() else: print plin,'-second print' return plin in range(0,11): print getplayerinput()
if input first 'rock' 'cat' 'paper' 'none'.
you not return once input not valid. instead:
def getplayerinput(): = ["rock","paper","scissors"] plin = raw_input("choose %s/%s/%s: " %(a[0], a[1], a[2])) print plin,'-first print' if plin not in a: print "wrong input" return getplayerinput() # <- added return else: print plin,'-second print' return plin in range(0,11): print getplayerinput()
otherwise recursion call return top level call, 1 swallows return value recursion call, since doesn't pass on via return.
Comments
Post a Comment