I am making a simple python game. I would like to be able to restart the game based on user input. You have a certain amount of guesses to guess which way to coin falls. If you lose you would get the option of restarting, instead of just breaking the code. Also the program will not print "you lose". And I can not figure out why.

import random
import sys
import os

print "You may press q to quit at any time"
print "You have six chances"
guess = 5
while guess >= 0:
    chance = random.choice(['heads','tails'])
    person = raw_input(" heads or tails: ")
    if person == 'q':
         print " Nooo!"
    if person == 'q':
    if person == chance:
        print "correct"
    elif person != chance:
        print "Incorrect"
        guess -=1
    elif guess == 0:
        print "you lose"

Edited 6 Years Ago by raden1: n/a

Never mind, for I have learned of the continue statement.

This question has already been answered. Start a new discussion instead.