"""
This program:
- asks the user to enter a string.
- verifies that the string represents a positive integer, and has the format:
- [optional] white space at the start
- [optional] minus sign
- a sequence of consecutive characters of digits, from 0 to 9.
- [optional] white space at the end

LIMITATION: It does not handle minus signs at the beginning of the number.
LIMITATION: It incorrectly treats white space strings as valid
    integers (and crashes as a result).
"""

text = input("enter an integer: ")
print("checking if", text, "is an integer...")
text = text.strip()

found_violation = False
for character in text:
    if not(character in "0123456789"):
        found_violation = True
        print("False")
        break

#if we never found space:
if (found_violation == False):
    print("True")
    number = int(text)
