I need this program to do one of two things from my repeat function, but it should be able to do both and I can't work out why. It must do 2 things
- make it rerun my main() subprogram,
- or say "Goodbye." and close the entire program, whichever one comes first.
I have tried making it just an if-else statement rather than if-elif-else, which didn't change anything, I have also tried rearranging the code, but that only changes the single output I can get from the subprogram. This is the subprogram currently:
def repeatloop():
repeat = input("Do you want to calculate another bill? (y/n): ")
if repeat == 'n' or 'N':
print("Goodbye.")
time.sleep(2)
sys.exit()
elif repeat == 'y' or 'Y':
main()
else:
print("Error. Program will shut down.")
time.sleep(2)
sys.exit()
It should be able to repeat the program (based on the y or Y input), terminate the program and display "Goodbye." based on the n or N input or it should display the "Error. Program will shut down." message before closing if an invalid input is entered. Many thanks to whoever can help me!