Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a Yes/No code included at the end of my program and cannot determine why

ID: 3630122 • Letter: I

Question

I need a Yes/No code included at the end of my program and cannot determine why it will not perform what I want.

Can you tell what code I need at the end of my program for:
If the answer is (Y) start the program again from the beginning, or if the answer is (N) print the statement "Thank you, Goodbye" quit

I'm posting my code here. (Python v3.2.2):
-------------------------------------------------------
#Entering account number
an = input("Enter your account number: ")
while not an.isdigit():
print ("Invalid Account Number, please re-enter")
an = input("Enter your account number: ")
an = int(an)

balance = int(1500)
print ("Balance in your account is:",(balance))
print ("Choose either 1 or 2")

#To show the available options:
print ("1. Deposit")
print ("2. Withdrawal")

#Defining input and choice:
ch = input("Please enter your choice: ")
ch = int(ch)

#Choice & Calculations:
if ch == 1:
deposit = input ("Enter the amount to deposit : ")
deposit = int(deposit)
total1 = int()
total1 = (deposit + 1500)
print ("Your balance after deposit is:",(total1))

if ch == 2:
withdrawl = input ("Enter the amount to withdrawl: ")
withdrawl = int(withdrawl)
total2 = int()
total2 = (1500 - withdrawl)
print ("Your balance after withdrawl is:",(total2))

print = input ("Would you like another transaction? y/n: ")

Explanation / Answer

#Entering account number

an = input("Enter your account number: ")

while not an.isdigit():

print "Invalid Account Number, please re-enter"

an = input("Enter your account number: ")

an = int(an)

balance = int(1500)

repeat='y'

while repeat =='y':

print ("Balance in your account is:",(balance))

print ("Choose either 1 or 2")

#To show the available options:

print ("1. Deposit")

print ("2. Withdrawal")

#Defining input and choice:

ch = input("Please enter your choice: ")

ch = int(ch)

#Choice & Calculations:

if ch == 1:

deposit = input ("Enter the amount to deposit : ")

deposit = int(deposit)

total1 = int()

total1 = (deposit + 1500)

print ("Your balance after deposit is:",(total1))

if ch == 2:

withdrawl = input ("Enter the amount to withdrawl: ")

withdrawl = int(withdrawl)

total2 = int()

total2 = (1500 - withdrawl)

print ("Your balance after withdrawl is:",(total2))

repeat = input ("Would you like another transaction? y/n: ")

if repeat=='n'

   print "Thank you, Goodbye"

      sys.exit()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote