# L-22.5 MCS 260 Wed 6 Aug 2014 : promptint.py
"""
Write a Python function prompt_integer that returns
a user given integer.  The function must ask the user each time
to retry when the conversion of the input into an integer fails.
"""

def prompt_integer():
    """
    Prompts the user for an integer and asks for a retry
    each time the conversion to an integer fails.
    Returns the user given integer.
    """
    while True:
        intraw = raw_input('give an integer : ')
        try:
            nbr = int(intraw)
            return nbr
        except ValueError:
            print 'conversion to int failed, please try again...'

X = prompt_integer()
print 'the integer :', X
