Untitled
unknown
plain_text
2 years ago
2.7 kB
9
Indexable
Contacts = [["" for _ in range(3)] for _ in range(100)]
CurrentSize = 0
Continue = True
while Continue:
print("Please enter a delete password, this will be require whenever you wish to clear your contact array.")
Password = input()
print("")
print("Are you sure? This cannot be change once set.")
print("Y/N")
pchoice = input()
if pchoice == "Y" or pchoice == "y":
Continue = False
Continue = True
while Continue:
print("")
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("")
print("Please select from the above.")
choice = input()
print("")
if choice == "1":
print("")
print("Please enter the last name of the contact.")
Contacts[CurrentSize][0] = input()
print("")
print("Please enter the first name of the contact.")
Contacts[CurrentSize][1] = input()
print("")
print("Please enter his/her telephone number.")
Contacts[CurrentSize][2] = input()
print("")
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 == "3":
print("This will completely clear out the entire list of contacts, are you sure?")
print("Y/N")
dchoice = input()
if dchoice == "Y" or dchoice == "y":
print("")
print("This action cannot be undo, are you really sure about it?")
print("Y/N")
d2choice = input()
print("")
if d2choice == "Y" or d2choice == "y":
print("Please enter your delete password.")
attempt = input()
if attempt == Password:
Contacts = [["" for _ in range(3)] for _ in range(100)]
CurrentSize = 0
print("")
print("Deleted.")
if not attempt == Password:
print("")
print("Incorrect password.")
if choice == "4":
print("I see, have a great day.")
Continue = FalseEditor is loading...
Leave a Comment