Program does not loop
<p>I'm curious as to why this program is not looping. The program will run once but when another game is played it doesn't record the winner and quits.</p>

<p>Any assistance will be greatly appreciated!</p>

<p>Here is the Python program:</p>

<pre><code>import random
random.seed()

print ("For each round please select from the following warriors: ")
print ("'C' or 'c' for Cowboy")
print ("'N' or 'n' for Ninja")
print ("'B' or 'b' for Bear")
print ("'Q' or 'q' for quit")
print()

gamesPlayed = 0

print ("Round", gamesPlayed +1, ":")
warriorStr = input("Please choose a warrior: ")
warriorStr = warriorStr.lower()

while not warriorStr.isalpha():
    print()
    print ("That's not a valid choice!")
    warriorStr = input("Please enter a weapon: ")

computer = random.choice("cnb")

count = 0
winCount = 0
lossCount = 0
tieCount = 0

if warriorStr == "n" or "N" and computer == "c" or "C":
    winCount = winCount + 1
    print ("You win")
elif warriorStr == "c" or "C" and computer == "b" or "B":
    winCount = winCount + 1
    print ("You win")
elif warriorStr == "b" or "B" and computer == "n" or "N":
    winCount = winCount + 1
    print ("You win")
elif warriorStr == "c" and computer == "n":
    lossCount = lossCount + 1
    print ("Computer wins")
elif warriorStr == "b" and computer == "c":
    lossCount = lossCount + 1
    print ("Computer wins")
elif warriorStr == "n" and computer == "b":
    lossCount = lossCount + 1
    print ("Computer wins")
elif warriorStr == "c" and computer == "c":
    tieCount = tieCount + 1
    print ("You tied")
elif  warriorStr == "n" and computer == "n":
    tieCount = tieCount + 1
    print ("You tied")
elif warriorStr == "b" and computer == "b":
    tieCount = tieCount + 1
    print ("You tied")

gamesPlayed = gamesPlayed + 1
print()
print ("Round", gamesPlayed +1, ":")
warriorStr = input("Choose a warrior: ")

if warriorStr == "q" and "Q":
    print("Game Over!")
    print ("You have played a total of", gamesPlayed, "games.")
    print ("You won", winCount, "times")
    print ("The computer won", lossCount, "times")
    print ("You tied", tieCount, "times")
</code></pre>

<p>Wrap the whole thing in a while loop.
Try something <em>like</em> this:</p>

<pre><code>warriorStr = input("Please choose a warrior: ")
warriorStr = warriorStr.lower()

acceptables = ['a','c','n','q']   

while warriorStr not 'q' and warriorStr in acceptables:

    warriorStr = input("Please enter a weapon: ")

    computer = random.choice("cnb")

    count = 0
    winCount = 0
    lossCount = 0
    tieCount = 0

    if warriorStr == "n" or "N" and computer == "c" or "C":
        winCount = winCount + 1
        print ("You win")
    elif warriorStr == "c" or "C" and computer == "b" or "B":
        winCount = winCount + 1
        print ("You win")
    elif warriorStr == "b" or "B" and computer == "n" or "N":
        winCount = winCount + 1
        print ("You win")
    elif warriorStr == "c" and computer == "n":
        lossCount = lossCount + 1
        print ("Computer wins")
    elif warriorStr == "b" and computer == "c":
        lossCount = lossCount + 1
        print ("Computer wins")
    elif warriorStr == "n" and computer == "b":
        lossCount = lossCount + 1
        print ("Computer wins")
    elif warriorStr == "c" and computer == "c":
        tieCount = tieCount + 1
        print ("You tied")
    elif  warriorStr == "n" and computer == "n":
        tieCount = tieCount + 1
        print ("You tied")
    elif warriorStr == "b" and computer == "b":
        tieCount = tieCount + 1
        print ("You tied")

    gamesPlayed = gamesPlayed + 1
    print()
    print ("Round", gamesPlayed +1, ":")
    warriorStr = input("Choose a warrior: ")

print("Game Over!")
print ("You have played a total of", gamesPlayed, "games.")
print ("You won", winCount, "times")
print ("The computer won", lossCount, "times")
print ("You tied", tieCount, "times")
</code></pre>

python loops