(2μͺ½) μ
κΈν¨μ μ½λ
def deposit(balance, money) :
print(f"μ
κΈμλ£. {balance}μμ {money}μμ μ
κΈν©λλ€.")
print(f"μ΄ μμ‘μ {balance + money}μμ
λλ€.")
return balance + money
# μ΄ν μ€μ€λ‘ μμ±
(2μͺ½) μΆκΈν¨μ μ½λ
def withdraw() :
#
print(f"{balance}μμμ {money}μμ μΆκΈν©λλ€.")
print(f"μ΄ μμ‘μ {balance β money}μμ
λλ€.")
return balance - money
#
print(f"μμ‘μ΄ λΆμ‘±ν©λλ€. νμ¬ μμ‘μ {balance}μμ
λλ€.")
return balance
# μ΄ν μ€μ€λ‘ μμ± (μ½λ μ€κ°μ€κ° λΉ μΉΈ μ±μΈ κ²)
(3μͺ½) μμλ£μ μμ‘ λ°ν μ½λ
def withdraw(balance, money) :
#
if balance >= money + commision :
print(f"{balance}μμμ {money}μμ μΆκΈν©λλ€.μμλ£λ {commision}μ.")
print(f"μ΄ μμ‘μ {balance β money - commision}μμ
λλ€.")
#
else :
print(f"μμ‘μ΄ λΆμ‘±ν©λλ€. νμ¬ μμ‘μ {balance}μμ
λλ€.")
return balance
# μ΄ν μ€μ€λ‘ μμ± (μ€κ°μ€κ° μ½λ μ±μΈ κ²)
(5μͺ½) κ³μ°κΈ° μ½λ
def calc(num1, num2, operation) :
if operation == '+' :
return num1 + num2
elif operation == '-' :
return num1 - num2
elif operation == '*':
return num1 * num2
elif operation == '/' :
if num2 != 0 :
return num1 / num2
elif num2 == 0 :
return "λΆλͺ¨κ° 0μ΄ λλ©΄ μ λ©λλ€."
elif operation == "^" :
return num1 ** num2
# μ΄ν μ€μ€λ‘ μμ±
(6μͺ½) 2.2κ°λ³μΈμ * μ½λ
def sport(name, sport1, sport2) :
print(f"{name}μ¨κ° ν μ μλ μ€ν¬μΈ λ {sport1}, {sport2}μ΄λ€.")
sport("Cha", "Tennis", "Soccer")
sport("Park","Baseball","Running")
(8μͺ½) ν¨μ 2κ° μ½λ
def step(num) :
if num < 1 :
return 0
elif num >= 1 :
return 1
def relu(num) :
if num >= 0 :
return num
elif num <0 :
return 0
(16μͺ½) 8.1 μ μλ³μμ μ§μλ³μ μ½λ
power = 10
def power_change(potion) :
power += potion
print(f'체λ ₯μ΄ {power}μ΄ λμμ΅λλ€.')
return power
(18μͺ½) μλ¬ μ²λ¦¬νκΈ° μ½λ
num1 = int(input("Enter the 1st num : "))
num2 = int(input("Enter the 2nd num : "))
print(f"{num1}/{num2} = {num1/num2}")