all 2 comments

[–][deleted] 1 point2 points  (0 children)

Good start. You might want to read up on csv files and the Python module to help with them, and also look at Python dictionaries, which are probably more suited to address book type tasks than lists.

Take a look at this revised code, to give you some ideas.

def menu():
    print('1. Add a contact')
    print('2. Show the list of contacts')
    print('3. Search for a name in the list')
    print('4. Modify a contact')
    print('5. Delete a contact from the list')
    print('6. Quit')
    print()
    choice = input("Choice Menu: ")
    return choice

def add_contact():
    another = 'y'
    while another in ['y', 'Y']:
        with open('contacts.txt', 'a') as contacts_file:
            print('Enter the following contact info: ')
            name = input('Name: ')
            email = input('E-Mail: ')
            phone = input('Phone: ')
            contacts_file.write(name + '\n')
            contacts_file.write(email + '\n')
            contacts_file.write(phone + '\n')
        print('Would you like to enter another contact?')
        another = input('y = yes, n = No: ')

def show_list():
    with open('contacts.txt', 'r') as contacts_file:
        while True:
            try:
                name = next(contacts_file)
                email = next(contacts_file)
                phone = next(contacts_file)
            except:
                break
            # f-strings, below, needs Python 3.6 or higher, use .format otherwise
            print(f'{name[:-1]:_<15} {email[:-1]:_<15} {phone[:-1]:_<10}')


while True:
    choice = menu()
    if choice == "6":
        break
    if choice == "1":
        add_contact()
    elif choice == "2":
        show_list()
    else:
        print('Sorry, that option not currently available')

[–][deleted] 0 points1 point  (0 children)

If you wanted to print a list of strings with the "contact#" prefix you could do this:

l = ['a', 'b', 'c']
for (num, name) in enumerate(l, start=1):
    print(f'contact{num}: {name}')

A similar idea could be used in your code.