tries = 0
while tries < 4:
deposit = input("Enter amount to deposit: ")
try:
deposit = int(deposit)
if deposit < 0:
raise "invalid output"
except:
print("This transaction cannot proceed. You entered amount in negative")
tries += 1
else:
print("Deposited: \tPKR ", deposit)
print("Current Balance: \tPKR %d"%(currentBalance + deposit))
currentBalance += deposit
print("Would you like to do any more Transaction?")
answer = input("Enter Y for Yes and N for No: ")
try:
if answer.isalpha() == False:
raise "invalid output"
except:
print("Your input was considered as 'N'")
main()
print("You entered invalid input three times. Now open your account again")
main()
for tries in range(0, 4):
deposit = input("Enter amount to deposit: ")
try:
deposit = int(deposit)
if deposit < 0:
raise "invalid output"
except:
print("This transaction cannot proceed. You entered amount in negative")
tries += 1
else:
print("Deposited: \tPKR ", deposit)
print("Current Balance: \tPKR %d"%(currentBalance + deposit))
currentBalance += deposit
print("Would you like to do any more Transaction?")
answer = input("Enter Y for Yes and N for No: ")
try:
if answer.isalpha() == False:
raise "invalid output"
except:
print("Your input was considered as 'N'")
main()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.