Created exception handling if the user doesn't provide the variable str with any input.