Functions and if - else in python. Mutliple conditions. Codeacademy

后端 未结 9 1420
-上瘾入骨i
-上瘾入骨i 2021-02-06 12:19

Write a function, shut_down, that takes one parameter (you can use anything you like; in this case, we\'d use s for string).

The shut_down func

9条回答
  •  情话喂你
    2021-02-06 12:44

    The code from the user 'grc' posted here, almost worked for me. I had to tweak the return message to get it right. If the message (meaning all returned strings) are not exactly the same as described on Codecademy, then the workspace will not validate your response.

    def shut_down(s):
    if s == "Yes" or s == "yes" or s == "YES":
        return "Shutting down"
    elif s == "No" or s == "no" or s == "NO":
        return "Shutdown aborted"
    else:
        return "Sorry"
    

提交回复
热议问题