Created
March 17, 2017 02:12
-
-
Save anonymous/0e784ef30407afdba925627e4a459e75 to your computer and use it in GitHub Desktop.
注文を取る
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
foods = {'0': '和食', '1': '洋食', '2': '中華'} | |
def order(): | |
while True: | |
print(list(foods.values())) | |
print('どれを食べますか (0/1/2)') | |
choice = input('>') | |
if choice not in foods: | |
print('入力エラー') | |
continue | |
break | |
while True: | |
print(f'{foods[choice]}で本当にいいですか(Y/N)') | |
answer = input('>') | |
if answer in ['n', 'N']: | |
return order() | |
elif answer not in ['y', 'Y']: | |
print('入力エラー') | |
continue | |
break | |
return choice | |
def main(): | |
choice = order() | |
print(f'{foods[choice]}を注文します') | |
print('完了') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment