Untitled

mail@pastecode.io avatar
unknown
plain_text
19 days ago
1.2 kB
4
Indexable
Never
Contacts = [["" for _ in range(2)] for _ in range(100)]
CurrentSize = 0

Continue = True
while Continue:
    print("Please select an option:")
    print("1. Enter new contact details")
    print("2. Display all the contact details")
    print("3. Delete all the contact details")
    print("4. Exit the software")
    choice = input()

    while not choice.isdigit() or (int(choice) < 1 or int(choice) > 4):
        print ("Please select from the above.")
        choice = input()
    
    if choice == "1":
        print("Please enter the name of the contact.")
        Contacts[CurrentSize][0] = input()
        print("Please enter his/her contact detail.")
        Contacts[CurrentSize][1] = input()
        CurrentSize = CurrentSize + 1
        print("You know what you have done.")
        
    if choice == "2":
        if CurrentSize == 0:
            print("But there is no one here. ")
        if CurrentSize == 1:
            print("There is only 1 contact detail here.")
        if CurrentSize <= 2:
            print("There are currently ",(CurrentSize)," contact details here.")
        print(Contacts)
        
    if choice == "4":
        print("I see, have a great day.")
        Continue = False
Leave a Comment