Startup Data scientist Blog

データ分析系のテック情報を発信します

python if関数を使った入力例

If関数 入力例

 

value = input('Would you like to continue? ')

if value == 'y' or value == 'yes':
    print('Continuing ...')
    print('Complete!')
elif value == 'n' or value == 'no':
    print('Exiting')
else:
    print('Please try again and respond with yes or no.')

 

<Output>

Would you like to continue? yes
Continuing ...
Complete!