I want this function to go test 3 statements and return the appropriate response. The three statements are and their intended responses are
'' - to have the response "blank space,
'hello' - to have the response "single word",
'world' - to have the response "another word"
The problem is 'world' is also giving the response "single word" instead of "single word again". Is there any way for python to detect hte previous response was "single word" and so it'll give the statement "single word again" if another single word is entered after the first single word?
def return_statement(statement):
if statement == (''):
response = "blank space"
return response
if ' ' not in statement
response = "single word"
return response
if ' ' not in statement and response == "single word":
response = 'single word again'
return response