작성은 top to bottom
def say_hello():
print("hello how r u?")
say_hello()
def say_hello(user_name):
print("hello", user_name, "how r u?")
say_hello("name")
def say_hello(user_name, user_age):
print("hello", user_name)
print("you r", user_age, "years old")
say_hello("name", 28)
def tax_calculateor(salary):
print(salary*0.35)
tax_calculateor(100)
def say_hello(user_name="everyone"):
print("hello", user_name)
say_hello()
def tax_calc(money):
return money*0.35
def pay_tax(tax):
print("thank you for paying", tax)
pay_tax(tax_calc(100000000))
print(f"hello I'm {my_name}")
def make_juice(fruit):
return f"{fruit}+juice"
def add_ice(juice):
return f"{juice}+ice"
def add_sugar(iced_juice):
return f"{iced_juice}+sugar"
juice = make_juice("apple")
cold_juice = add_ice(juice)
perfect_juice = add_sugar(cold_juice)
print(perfect_juice)
# apple+juice+ice+sugar
return은 함수의 끝(이후 값은 전달 x)