Source Code :
def display(contacts):#function to display contacts if len(contacts) == 0:#if no contacts present print("No Contacts to display.\n") return else:#if contacts are present i = 1 # For printing the index as string on the contact for row in contacts:#loop for all contacts print("{}. {}".format(str(i), row[0])) i += 1#increment number to display contact number print() def add(contacts):#function to add contact name = input("Name: ") #user input for name email = input("Email: ") #user input for email phone = input("Phone: ") #user input for phone contacts.append([name, email, phone])#add details to list print("{} was added.\n".format(name)) def view(contacts):#function to view contacts number = int(input("Number: ")) #input number from user if number <= len(contacts) + 1 and number>0:#if valid user number is provided contact = contacts[number - 1] #contact row print("Name: {}\nEmail: {}\nPhone: {}\n".format(contact[0], contact[1], contact[2])) else:#if number not in range print("Enter valid Contact Number\n") return def delete(contacts):#function to delete contact number = int(input("Number: "))#input number from user name = contacts.pop(number-1)[0]#delete contact using index print("{} was deleted\n".format(name)) def display_title(): # funnction to display title print("Contact Manager\n") def display_menu(): # function to display menu print("list - Display all contacts\nview - View a contact\n" "add - Add a contact\ndel - Delete a contact\nexit - Exit program\n") def main():#main program #2-dimensional storage of contacts contacts = [["Guido van Rossum", "[email protected]", "+31 0474 33 8826"], ["Eric Idle", "[email protected]", "+44 20 7946 0958"]] display_title()#function call display_menu()#function call while True:#loop untill exit option = input("Command:")#user input for command option if option == "exit":#to exit print("\nThank you for using my app.") break#break loop elif option in ["list", "view", "add", "del"]: #valid options to proceed if option == "list": display(contacts)#function call continue if option == "view": view(contacts)#function call continue if option == "add": add(contacts)#function call continue if option == "del": delete(contacts)#function call continue else: #invalid options print("Enter a valid option\n") main() #call main program
Screenshot of Code :
Output - Screenshot :
Note :
Need help. Please write Python program that answer the prompt and has an sample output as...
Write the code in python, if you cannot answer all the question please dont anser, thanx very much. Please gimme a screen shot for code. Write clear code with comments and follow coding convention. Comments should include your name, student number and subject code on top of your code Question 1 Create a list to store all the subject codes that you are currently doing at UOW Then use for loop to display it in a table as in the...
I really need help with this python programming assignment asap please double check indentations, thank you We were unable to transcribe this imageEnter a drink option: Milk 22 Guest #1: a Please select the number of your entree choice 1) Planked salmon, 2) Prime rib, 3) Sesame tofu with spinach: 3 Please select the number of your dessert choice 27 1) Caramel oat bar, 2) Chocolate decadence, 3) Orange creme brulee: 1 Please select the number of your drink choice...
I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...