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

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

    def shut_down(phrase):
        word = phrase
        return word
    
    take_action = input(shut_down('do you want to shutdown the program?: '.title()))
    if take_action.lower() == 'yes':
        print('Shutting down...')
    elif take_action.lower() == 'no':
        print('Shutdown aborted!')
    else:
        print('Sorry, I didn\'t understand you.')
    

提交回复
热议问题