from random import randint

n = randint(0, 100)
i = -1
while i != n:
    ok = False
    while not (ok):
        try:
            i = int(input('Rentrez un nombre entre 0 et 100:'))
            if i >= 0 and i <= 100:
                ok = True
            else:
                print('Nombre invalide')
        except ValueError:
            print('Erreur de saisie')

    if i > n:
        print('Votre nombre est trop grand')
    if i < n:
        print('Votre nombre est trop petit')


print ('Vous avez gagné !')
