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

后端 未结 9 1424
-上瘾入骨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:43

    I'm a python programmer and have finished Codecademy. I see that you have a problem and let me give you my answer. It runs perfectly

    def shut_down(s):
        if s == "yes":
            return "Shutting down"
        elif s == "no":
            return "Shutdown aborted"
        else:
            return "Sorry"
    

提交回复
热议问题