Why Am I Getting This Error In Python When I Enter Into Next Line Of If-else Condition?
if cake == 'delicious': return 'yes' SyntaxError: 'return' outside function Why I get like this?
Solution 1:
You can create some functions like this.
text ="delicious"
def check(text):
if text=="delicious":
return 'yes'
check(text)
Solution 2:
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')
Post a Comment for "Why Am I Getting This Error In Python When I Enter Into Next Line Of If-else Condition?"