프로그래밍 공부

함수활용 실습문제 11-20, 커피 구매하기

응_비 2020. 10. 24. 13:39

def coffee(c):

  if (c == 'Americano'):

    a = 3900

  elif ( c == 'Cafe mocha'):

    a = 45000

  elif (c == 'Cafe Latte'):

    a = 5000

  elif (c == 'Green Tea Latte'):

    a = 5500

  return a

 

def size(s):

  if s == 'G':

    b = 1000

  elif s == 'R':

    b = 500

  elif s == 'S':

    b = 0

  return b

 

def price(ab):

  pay  = a+b

  return pay

 

print('Welcome to Harry Caffe')

c = str(input('Choose 1 : Americano / Cafe mocha / Cafe Latte / Green TEa Latte :'))

s = str(input('Choose size : G(grande) / R(regular) / S(short) :'))

a = coffee(c)

b = size(s)

print("총 금액은"price(a, b)"원 입니다.")