I need to make a program to store contacts (Name and phone number). The first step is to make the program run unless the input is 'exit'. The program should offer a set of options. My problem is that when I enter an option it offers again the set of options and I have to enter the option for a second time for it to run.
I kind of understand why the program does that so I tried it with a while True but it didn't work.
def main():
options = input( "Select an option [add, query, list, exit]:" )
while options != "exit" :
options = input( "Select an option [add, query, list, exit]:" )
# Offrir un choix de commandes
if options == "add":
add_contact(name_to_phone)
if options == "query":
query_contact(name_to_phone)
if options == "list":
list_contacts(name_to_phone)
Select an option [add, query, list, exit]:add
Select an option [add, query, list, exit]:add
Enter the name of a new contact: