I'm new to Python v3 and am using a while loop at the end of my program to determine if the user wants to restart/retry the program or finish.
If I select yes and I repeat the program more than once and then select no, I keep returning the "Would you like to search again: (Y/N) > " option for the number of times I re-tried the program e.g. 3 attempts and I have to enter n three times before break takes effect.
Code used is below.
while True:
finish_input = input("Would you like to search again: (Y/N) > ")
if finish_input.lower() == ("y"):
my_project()#restarts the program from the start
continue
elif finish_input.lower() == "n":
print()
print("Thank you for using this service.")
break
else:
print()
print("Invalid entry. Please enter Y or N")
I want the option to restart but only have to input n once to close/break the program and exit. Help would be really appreciated.