The following tags have no closing tag: i, i
Whoops sorry couldn't upload the file so here it is in text
class Person:
def __init__(self, firstname, lastname, phonenumber):
self.__firstname = firstname
self.__lastname = lastname
self.__phonenumber = phonenumber
def getlastname(self):
return self.__lastname
def get_info(self):
return self.__firstname + " " + self.__lastname + " " + self.__phonenumber
class Friend(Person):
def __init__(self, firstname, lastname, phonenumber, email, birthdate):
super().__init__(firstname, lastname, phonenumber)
self.__email = email
self.__birthdate = birthdate
def get_info(self):
return super().get_info() + " " + self.__email + " " + self.__birthdate
def displayMenu():
print("Main Menu")
print("1: Add a Contact")
print("2: Lookup contact by name")
print("3: Exit")
choice = int(input("Enter your choice: "))
return choice
contacts = []
def main():
choice = displayMenu()
while (choice != 3):
if(choice==1):
print("Press 1 to add a regular contact or press 2 to add a friend")
ch = int(input("Enter your choice: "))
firstname=input("Enter first name: ")
lastname=input("Enter last name: ")
phonenumber=input("Enter phone number: ")
if (ch==2):
email=input("Enter email address: ")
birthdate=input("Enter birthdare: ")
friend=Friend(firstname, lastname, phonenumber, email, birthdate)
contacts.append(friend)
else:
person=Person(firstname, lastname, phonenumber)
contacts.append(person)
elif (choice==2):
last=input("Enter last name to search: ")
for i in range(0, len(contacts)):
if (contacts.getlastname()==last):
info=contacts.get_info()
print(info)
elif (choice==3):
#exit print("Exit")
else:
print("ERROR:: Invalid option entered. Try again.")
choice = displayMenu()
main()