From 3be335b9cc52e140fcfbcf0d484afeb8098acbf4 Mon Sep 17 00:00:00 2001 From: kjg Date: Mon, 8 Jun 2020 22:00:57 +0900 Subject: [PATCH] [Python #7] create e37.py --- kjg/python-the-hard-way/e37.py | 26 ++++++++++++++++++++++++++ kjg/python-the-hard-way/sum.txt | 3 --- kjg/python.org | 3 +++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 kjg/python-the-hard-way/e37.py diff --git a/kjg/python-the-hard-way/e37.py b/kjg/python-the-hard-way/e37.py new file mode 100644 index 0000000..185cad8 --- /dev/null +++ b/kjg/python-the-hard-way/e37.py @@ -0,0 +1,26 @@ +while 1: + money = input("insert coin=>") + number = input("select beverage\n") + money = int(money) + temp = money + if number == "1": + #grape 100 + print("you choose grape. change is ",money-100,"coin") + money = temp-100 #callculate change + if money <= 0: #check money + break + elif number == "2": + #orange 200 + print("you choose orange. change is ",money-200,"coin") + money = temp-200 #callculate change + if money <= 0: #check money + break + elif number == "3": + #fanta 300 + print("you choose fanta. change is ",money-300,"coin") + money = temp-300 #callculate change + if money <= 0: #check money + break + else: + #wrong sellection + print("wrong number. please select again") diff --git a/kjg/python-the-hard-way/sum.txt b/kjg/python-the-hard-way/sum.txt index 8707584..e69de29 100644 --- a/kjg/python-the-hard-way/sum.txt +++ b/kjg/python-the-hard-way/sum.txt @@ -1,3 +0,0 @@ -23+45+23+4+1+54=150 -2+3+4+6+7+8=30 -9+8+7+7+8+0=39 diff --git a/kjg/python.org b/kjg/python.org index 4ad8087..00f1762 100644 --- a/kjg/python.org +++ b/kjg/python.org @@ -135,3 +135,6 @@ practice function, while, if some rules of if, loop and tips for debugging *** Python applying learnings from 1..6 create calc.py +*** Python #7 +**** ex37 +analysis sample codes