#!/usr/bin/python3
# coding=utf-8

from random import *

def ask_a_number ():
    return int (input ("Guess: "))

secret_number = 10
already_won = False
attempts = 0

while not already_won:
    guess = ask_a_number ()
    attempts = attempts + 1
    if guess < secret_number:
        print ("My number is higher")
    elif guess > secret_number:
        print ("My number is lower")
    else:
        print ("You won.")
        already_won = True
print ("You took " + str (attempts) + " attempts.")
