if cake == \"delicious\":
return \"yes\"
SyntaxError: \'return\' outside function
Why I get like this?
return
is a keyword which can only appear in a function definition (as the syntax error says). You can simply print your output in an if/else block
if cake == 'delicious': print('yes')
You can create some functions like this.
text ="delicious"
def check(text):
if text=="delicious":
return 'yes'
check(text)