def min_payment():
''' Calculates the minimum payment due on credit card
depending on the credit card balance'''
print("Tiny National Bank of Walterville")
print("Credit Card Payments")
balance = float(input("Please enter Credit Card Balance"))
print("Credit Card Balance: " ,round(float(balance), 2))
min1 = 12.00
min2 = round(.027 * balance, 2)
if min2 > min1:
print("Minimum payment due: ", min2)
elif balance <= 0:
print("No payment due")
elif balance < min1:
print("Minimum payment due: ", balance)
else:
print("Minimum payment due: ", min1)
如果有人能告诉我如何循环,以便我可以根据用户输入重复它,那将非常有帮助。我基本上希望它说类似“另一个客户(y 或 n)?”
要求用户选择 y 或 n。另外请不要对实际代码过于挑剔。我还在学习。顺便说一句,它的蟒蛇。谢谢!