Can anyone help me understand why my very simple rock paper scissors code gets stuck and exits at the end of line 18 please? I´ve tested each part individually and it works, it might not be the prettiest code but it seems to do the job, however in it´s latest itteration it just exits at the en of line 18, exit code 0, so no error, does´nt say anything is wrong, it just doesn´t execute the next line, like there´s a break or an exit on that line, but there isn´t:
import random
def startgame():
print("Please choose rock - r, paper - p or scissors - s:")
pchoice = input(str())
if(pchoice.lower in ["r","rock"]):
pchoice = "0"
elif(pchoice.lower in ["s","scissors"]):
pchoice = "1"
elif(pchoice.lower in ["p","paper"]):
pchoice = "2"
cchoice = (str(random.randint(0,2)))
if(cchoice == "0"):
print("Computer has chosen: Rock \n")
elif(cchoice == "1"):
print("Computer has chosen: Scissors \n")
elif(cchoice == "2"):
print("Computer has chosen: Paper \n")
#runs perfect up to here, then stops without continuing
battle = str(pchoice + cchoice)
if(battle == "00" and "11" and "22"):
print("Draw! \n")
playagain()
elif(battle == "02" and "10" and "21"):
if(battle == "02"):
print("You Lose! \nRock is wrapped by paper! \n")
elif(battle == "10"):
print("You Lose! \nScissors are blunted by rock! \n")
elif(battle == "21"):
print("You Lose! \nPaper is cut by scissors! \n")
playagain()
elif(battle == "01" and "12" and "20"):
if(battle == "01"):
print("You Win! \nRock blunts scissors! \n")
elif(battle == "12"):
print("You Win! \nScissors cut paper! \n")
elif(battle == "20"):
print("You Win! \nPaper wraps rock! \n")
playagain()
def main():
print("\nWelcome to Simon´s Rock, Paper, Scissors! \n \n")
startgame()
def playagain():
again = input("Would you like to play again? y/n \n \n")
if(again == "y"):
startgame()
elif(again == "n"):
print("Thank you for playing")
exit()
else:
print("Please choose a valid option...")
playagain()
main()