I need to write code that checks if a certain input string is valid. It must:
- Contain a "space" in the input string which separates words
- Not contain multiple consecutive spaces in a row
- Not contain just a "space" (just single space as an input).
Here is what I mean:
username = str(input())
print(username)
username = "two apples" # acceptable
username = "two apples and pears" # acceptable
username = "two' '' 'apples" # not acceptable (because of 2 spaces in a row or more)
username = " " # not acceptable (because of single space with no other words.)
username = "' '' '' '' '' '' '" #not acceptable because of multiple spaces (didn't know how to type it in here better to clarify.