くだすれPython(超初心者用) その32at TECH
くだすれPython(超初心者用) その32 - 暇つぶし2ch854:デフォルトの名無しさん
17/03/17 19:41:57.57 dpI1G6OF.net
>>838
俺ならこうかな
foods = ['和食', '洋食', '中華']
def choiceInput(prompt, choices):
 while True:
  print(prompt)
  choice = input('>')
  if choice in choices:
   return choice
  print('入力エラー')

def order():
 while True:
  print('和食, 洋食, 中華')
  choice = choiceInput('どれを食べますか (0/1/2)', ['0','1','2'])
  yesNo = choiceInput(f'{foods[choice]}で本当にいいですか(Y/N)', ['Y', 'y', 'N','n'])
  if yesNo in ['Y', 'y']:
   return choice


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch