편집 기록

편집 기록
  • 프로필 nowp님의 편집
    날짜2021.01.07

    파이썬 기초 : 타입에러


    
    def open_account():
        print("새로운 계좌가 생성되었습니다.")
    
    def deposit(balance, money):
        print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance + money))
        return balance + money
    
    def withdraw(balance, money):
        if balance >= money:
            print("출금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance - money))
            return balance - money
        else:
            print("출금이 완료되지 않았습니다. 잔액은 {0}원 입니다.".format(balance))        
    
    def withdraw_night(balance, money):
        commssion = 100
        return commssion, balance - money - commssion
    
    balance = 0
    balance = deposit(balance, 1000)
    balance = withdraw(balance, 2000)
    commssion, balance = withdraw_night(balance, 500)
    print("수수료 : {0}원이며, 잔액은 {1}원 입니다.".format(commssion, balance))
    

    입출금 프로그램 연습중 입니다.

    return commssion, balance - money - commssion 부분과 commssion, balance = withdraw_night(balance, 500) 부분에서 타입 에러가 났는데 도저히 원인을 모르겠습니다. 이게 코드 문제인지 프로그램 설정 문제인지 알려주시면 감사하겠습니다.

  • 프로필 승현님의 편집
    날짜2021.01.07

    파이썬 기초 문법 질문


    
    def open_account():
        print("새로운 계좌가 생성되었습니다.")
    
    def deposit(balance, money):
        print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance + money))
        return balance + money
    
    def withdraw(balance, money):
        if balance >= money:
            print("출금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance - money))
            return balance - money
        else:
            print("출금이 완료되지 않았습니다. 잔액은 {0}원 입니다.".format(balance))        
    
    def withdraw_night(balance, money):
        commssion = 100
        return commssion, balance - money - commssion
    
    balance = 0
    balance = deposit(balance, 1000)
    balance = withdraw(balance, 2000)
    commssion, balance = withdraw_night(balance, 500)
    print("수수료 : {0}원이며, 잔액은 {1}원 입니다.".format(commssion, balance))
    

    입출금 프로그램 연습중 입니다.

    return commssion, balance - money - commssion 부분과

    commssion, balance = withdraw_night(balance, 500) 부분에서

    타입 에러가 났는데 도저히 원인을 모르겠습니다.

    이게 코드 문제인지 프로그램 설정 문제인지 알려주시면 감사하겠습니다.