strip() function in Python is very useful in this case; it will remove leading and trailing space from the user-entered value.