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

后端 未结 9 1407
-上瘾入骨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 13:07

    You can do it a couple of ways:

    if s == 'Yes' or s == 'yes' or s == 'YES':
        return "Shutting down..."
    

    Or:

    if s in ['Yes', 'yes', 'YES']:
        return "Shutting down..."
    

提交回复
热议问题