User blog:Connorgm/10/3/14 SDD - Creating A Guessing Game: Python

import math

import random

loop = 1

while loop != 0:

print ("The Guessing game")

print ("Guess the number between 1-100 and win")

start = input("Start? y/n")

if start == "y":

print ("Lets begin")

no = random.randrange(1,100)

print ("I have a number in my head, start guessing")

guesscounter = 10

print(no)

while guesscounter <=10:

guesscounter-=1

guess = input("What number do you think it is?")

guess = int(guess)

if guesscounter <= 0:

print("Soz man, you lost")

elif guess == no:

print("You are a winner, nice.  And it only took", guesscounter, "turns")

break

elif guess != no:

print("Wrong, you have", guesscounter , "turns left")

if int(guess) < int(no):

print("try aiming higher")

print("")

else:

print("try aiming lower")

print("")

print("")

again = input("Again? y/n")

if againt == "n":

loop = 0

elif input == "y":

loop = 1

else:

print("Don't know what you said, repeating")