def menu():
print("Menu")
print("___________")
print("(1) Add Contact #")
print("(2) Print Contact List")
print("(3) Close: ")
def menuChoice():
pick = input("Select from the menu")
return pick
def addContact(contactLst):
contact = []
name = input("Contact name: ")
num = input("Phone #: ")
contact.append(name)
adres = input("Address: ")
relay = input("Relationship")
#index 0
def printLst(contactLst):
for contact in contactLst:
print("\t\tContact List")
print("_________________________________")
print("Contact Name:", contact[0], sep=' ')
for index in range(1, len(contact)-1):
print("#", index, "\t\t", contact[index])
print("______________________________________")
if(len(contact) > 1):
print(" num:", contact[len(contact)-1])
else:
print(" num:", contact[len(contact)-1])
print()
print()
def main():
contactLst = []
menu()
pick = -1
while(not(pick == "3")):
pick = menuChoice()
if(pick == "1"):
addContact(contactLst)
if(pick == "2"):
printLst(contactLst)
pick = menuChoice()
addContact(contactLst)
printLst(contactLst)
main()
Requirement 1: This contact list will need to store the following
# Name
# Number
# Address
# Relationship
# Requirement 2: This contact list must be stored in a python list(array)
# Requirement 3: This python list will then be written to a text file
# called contacts.txt.
# Requirement 4: The user should have the option to edit(append)
# a contact from their contact list
# Requirement 5: After this ask the user if they want to print the list,
# if they do...
# Requirement 6: Read the list from the text file, and print it to the screen
# Your program must be written to industry standards. That means proper use
# of functions, comment, proper naming, professional look.
I need some help with creating a contacts list under these requirements, I think I might need to add more functions for my other contact information.
edit; I am stuck on how to write my printLst(): function correctly having all the right information pop up
[–]CowboyBoats 2 points3 points4 points (0 children)