강의

멘토링

커뮤니티

Inflearn Community Q&A

finalcut022069's profile image
finalcut022069

asked

Free Python Tutorial (Basic) - Become a Developer in 6 Hours

Argument and Return Value

제가 이렇게 만들어 봤는데 살짝 맘에 안드는게 있어서여...

Written on

·

154

0

제가 계좌에 들어있는 돈 보다 출금할 돈이 많으면 이렇게 input을 활용해 다시 한번 질문을 하게 만들고 y를 ㄴ르면 계좌에 있느논이 -로 표시될려고 하는데.... 다른건 다 괜찮은데 끝나고 나서 account함수를 열어 봤더니 None원 이라고 합니다 왜이러는 거죠?

코드 -->

def account(balance):

    print("현재 계좌에 들어 있는 돈은 {0} 원입니다.".format(balance))

    return balance


def deposit(balancemoney): # 입금

    print("입금이 완료되었습니다. 현재 계좌에 들어 있는 돈은 {0} 원입니다.".format(balance + money))

    return balance + money


yes = "y"

no = "n"


def withdraw(balancemoney): # 출금

    if balance >= money:

        print("출금이 완료되었습니다. 현재 계좌에 들어 있는 돈은 {0} 원입니다.".format(balance - money))

        return balance - money


    elif balance <= money:

        withdraw_license = input("현재 계좌에 들어 있는 돈이 출금할 돈보다 적습니다. 출금 하시겠습니까? (y or n)")


        if withdraw_license != no:

            print("출금이 완료되었습니다.")


        elif withdraw_license != yes:

            print("출금이 취소되었습니다.")

            return balance


balance = 0

balance = deposit(balance, 1000)

balance = withdraw(balance, 2000)

account(balance)
python

Answer

This question is waiting for answers
Be the first to answer!
finalcut022069's profile image
finalcut022069

asked

Ask a question