Python

Return

한고운 2024. 8. 22. 01:23

# Return Valuse 1
def tax_calc(money):
  return money * 0.35

def pay_tax(tax):
  print("thank you for paying", tax)

to_pay = tax_calc(150)
pay_tax(to_pay)

pay_tax(tax_calc(150))

# Return Valuse 2 
my_name = "gowoon"
my_age = 42
my_color_eyes = "brown"

# f"{변수} + 문자열"
print(f"Hello I'm {my_name}, I have {my_age} years in the earth, {my_color_eyes} is my eye color")

# practice
def make_juice(fruit):
  return f"{fruit}+🥤"

def add_ice(juice):
  return f"{juice}+🧊"

def add_sugar(iced_juice):
  return f"{iced_juice}+🍬"

fruit = "🍎"
juice = make_juice(fruit)
iced_juice = add_ice(juice)
perfect_juice = add_sugar(iced_juice)
print(perfect_juice)