-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
해결됨
예시 수정해서 해보는데 계속 error 떠서요
20.10.03 20:27 작성 조회수 146
1
#왜 안 돌아가는지 잘 모르겠습니다
def deposit(balance, money):
print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance+money))
return balance+money
def withdraw_night(balance, money):
commission=100
if balance>=money+commission #여기서 syntax 에러 납니다 제가 봤을 때는 문제 없는 것 같습니다...
print("출금이 완료되었습니다. 수수료 {0}원이고, 잔액은 {1}원 입니다.".format(commission, balance-money-commission))
return commission, blance-money-commission
else:
print("출금불가합니다. 잔액은 {0}원 입니다.".format(balance))
return commission, balance
balance=0
balance=deposit(balance, 500)
withdraw_night(balance, 500)
#왜 안 돌아가는지 잘 모르겠습니다
def deposit(balance, money):
print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance+money))
return balance+money
def withdraw_night(balance, money):
commission=100
if balance>=money+commission #여기서 syntax 에러 납니다 제가 봤을 때는 문제 없는 것 같습니다...
print("출금이 완료되었습니다. 수수료 {0}원이고, 잔액은 {1}원 입니다.".format(commission, balance-money-commission))
return commission, blance-money-commission
else:
print("출금불가합니다. 잔액은 {0}원 입니다.".format(balance))
return commission, balance
balance=0
balance=deposit(balance, 500)
withdraw_night(balance, 500)
답변을 작성해보세요.
1
2혹등고래
2020.10.08
저도 배우는 입장이라 잘 된건지 모르겠지만 일단 되어서 올려봅니다.
def open_account():
print("새로운 계좌가 생성되었습니다.")
def deposit(balance, money):
print("입금이 완료되었습니다. 잔액은 {0}원 입니다.".format(balance+money))
return balance+money
def withdraw_night(balance, money):
commission=100
if balance>=money+commission: # ":" 생략됐습니다
print("출금이 완료되었습니다. 수수료 {0}원이고, 잔액은 {1}원 입니다.".format(commission, balance-money-commission))
return commission, balance-money-commission #blance 오타났습니다
else:
print("출금불가합니다. 잔액은 {0}원 입니다.".format(balance))
return commission, balance
balance=0
balance=deposit(balance, 1000) #일부러그러신건지 모르겠지만 잔고에 500(기준에 되는 잔고)만 부여하셔서 아래 잔액이 잘 안나옵니다
commission, balance=withdraw_night(balance, 300) #withdraw_night 함수에 commission변수도 있어서 commission도 나타내야 합니다
0
답변 2