Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Max = 10000 # Max withdraw allowed is 10000
- deposit_input = input("Enter the number of denominations to be deposited: ")
- # deposit part
- L = deposit_input.split(",")
- deposit = [int(d) for d in L]
- # conversion of the user input deposit
- d_20, d_50, d_100, d_200, d_500, d_1000 = deposit
- total = (d_20 * 20) + (d_50 * 50) + (d_100 * 100) + (d_200 * 200) + (d_500 * 500) + (d_1000 * 1000)
- print("Your starting balance is:", total, "pesos")
- withdrawing = True
- while withdrawing:
- condition = True
- d_20, d_50, d_100, d_200, d_500, d_1000 = deposit
- d_20check = d_20
- d_50check = d_50
- d_100check = d_100
- d_200check = d_200
- d_500check = d_500
- d_1000check = d_1000
- total = (d_20 * 20) + (d_50 * 50) + (d_100 * 100) + (d_200 * 200) + (d_500 * 500) + (d_1000 * 1000)
- while condition:
- proceed = True
- wit = input("Enter the amount you want to withdraw: ")
- withd = int(wit)
- reversed_num = str(withd)[::-1]
- digits = [int(digit) for digit in str(reversed_num)]
- withdcheck = withd
- if 0 < digits[0] < 10 or digits[1] == 1:
- print("Invalid Amount Inputted")
- else:
- if 0 < withdcheck <= Max:
- while withdcheck > 0:
- if d_1000check > 0 and withdcheck >= 1000:
- dispensedcheck = withdcheck // 1000
- withdcheck -= dispensedcheck * 1000
- d_1000check -= dispensedcheck
- elif d_500check > 0 and withdcheck >= 500:
- dispensedcheck = withdcheck // 500
- withdcheck -= dispensedcheck * 500
- d_500check -= dispensedcheck
- elif d_200check > 0 and withdcheck >= 200:
- dispensedcheck = withdcheck // 200
- withdcheck -= dispensedcheck * 200
- d_200check -= dispensedcheck
- elif d_100check > 0 and withdcheck >= 100:
- dispensedcheck = withdcheck // 100
- withdcheck -= dispensedcheck * 100
- d_100check -= dispensedcheck
- elif d_50check > 0 and withdcheck >= 50:
- dispensedcheck = withdcheck // 50
- withdcheck -= dispensedcheck * 50
- d_50check -= dispensedcheck
- elif d_20check > 0 and withdcheck >= 20:
- dispensedcheck = withdcheck // 20
- withdcheck -= dispensedcheck * 20
- d_20check -= dispensedcheck
- else:
- proceed = False
- print("Invalid withdrawal amount!")
- break
- if proceed == True:
- while withd > 0:
- if d_1000 > 0 and withd >= 1000:
- dispensed = withd // 1000
- withd -= dispensed * 1000
- d_1000 -= dispensed
- print("Dispensing", dispensed, "1000-peso banknotes.")
- elif d_500 > 0 and withd >= 500:
- dispensed = withd // 500
- withd -= dispensed * 500
- d_500 -= dispensed
- print("Dispensing", dispensed, "500-peso banknotes.")
- elif d_200 > 0 and withd >= 200:
- dispensed = withd // 200
- withd -= dispensed * 200
- d_200 -= dispensed
- print("Dispensing", dispensed, "200-peso banknotes.")
- elif d_100 > 0 and withd >= 100:
- dispensed = withd // 100
- withd -= dispensed * 100
- d_100 -= dispensed
- print("Dispensing", dispensed, "100-peso banknotes.")
- elif d_50 > 0 and withd >= 50:
- dispensed = withd // 50
- withd -= dispensed * 50
- d_50 -= dispensed
- print("Dispensing", dispensed, "50-peso banknotes.")
- elif d_20 > 0 and withd >= 20:
- dispensed = withd // 20
- withd -= dispensed * 20
- d_20 -= dispensed
- print("Dispensing", dispensed, "20-peso banknotes.")
- else:
- print("Invalid withdrawal amount!")
- break
- balance = total - int(wit)
- total = balance # Update the total to the new balance
- print("Available balance:", balance, "pesos")
- else:
- print(
- "Invalid withdrawal amount. The maximum withdrawal amount is 10,000 pesos. Please enter a valid amount.")
- decision = input("Do you want to withdraw again? (Y/N) ")
- if decision == "Y":
- continue
- else:
- condition = False
- print("THANK YOU FOR BANKING!\nAvailable balance: ", total)
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement