我需要编写一个程序:
我遇到问题的主要区域:2。 - 撤回直到循环。
示例输出:
What is your starting balance: $ 1000.00
What is your withdrawal amount: $ 250.00
What is your withdrawal amount: $ 295.00
What is your withdrawal amount: $ 187.50
What is your withdrawal amount: $ 0
Your account balance is: $267.50
答案 0 :(得分:0)
#!/usr/bin/env python3.3
amt = int(input("What is your starting balance: $"))
while(True):
i = int(input("What is your withdrawal amount: $"))
if(i == 0):
break
else:
amt -= i
print("Your account balance is:"+str(amt))