""" Purpose: demonstrate string method strip() """ # Get text reply = input( "Enter text: " ) # Get a cleaned version of the text s = reply.strip() # remove all leading and trailing whitespace # strip() will NOT remove interior spaces, only leading and trailing # if you're looking to get a number from input(), it never hurts to strip() first before casting # Show differences in the strings print() print( "string of interest:", reply, ":" ) print( " stripped version:", s, ":" )