def add_contact(contacts,size):
print("==============================")
if size < 100:
print("Please enter a new contact information(maximum 5): ")
for x in range(5):
fn = input("last name, first name: ")
cn = input("contact number: ")
contacts.append([fn,cn])
more = input("Add another? (Y/N): ")
if more == 'N' or more == 'n':
sort_contact(contacts,size)
break
else:
sort_contact(contacts,size)
print("==============================")
else:
print("Not enough space.")
def display_contact(contacts,size):
print("==============================")
print("Current Contact:")
for y in range(size):
print(f"1. {contacts[y][0]}: {contacts[y][1]}")
def remove_contact():
print("Contacts removed")
print("==============================")
def sort_contact(contacts,size):
for y in range(size):
min_index = y
for x in range(y+1,size):
if contacts[y][0] < contacts[min_index][0]:
min_index = x
contacts[y],contacts[min_index] = contacts[min_index],contacts[y]
contactList = []
currentSize = len(contactList)
while True:
print("==============================")
print("What would you like to do:")
print("1. Add contact")
print("2. Display contacts")
print("3. Remove ALL contacts")
print("==============================")
a = input("Choice: ")
if a == '1':
add_contact(contactList,currentSize)
elif a == '2':
display_contact(contactList,currentSize)
elif a == '3':
contactList = []
remove_contact()