# -*- coding: utf-8 -*-
class NameCard:
    def __init__(self, name, age, IG, phone):
        self.name = name
        self.age = age
        self.IG = IG
        self.phone = phone
    def __str__(self):
        return "name: {}, age: {}, IG: {}, phone: {}"\
                .format(self.name, self.IG, self.age,
                       self.phone)
def get_menu():
    while True:
        try:
            menu = int(input("menu: "))
            return menu
        except:
            print("You entered the menu incorrectly. Please re-enter.")
def get_namecard_info():
    name = input("name: ")
    age = input("age: ")
    IG = input("IG: ")
    phone = input("phone: ")
    card = NameCard(name, age, IG, phone)
    return card
def find_namecard(namecard_list, phone):
    for i, card in enumerate(namecard_list):
        if phone==card.phone:
            return i
    return -1
namecard_list = []
while True:
    print("INSERT(1), SEARCH(2), MODIFY(3), DELETE(4), EXIT(0)")
    menu = get_menu()
    if menu==1:
        new_card = get_namecard_info()
        namecard_list.append(new_card)
    elif menu==2:
        find_phone = input("The phone number of the person you are looking for : ")
        index = find_namecard(namecard_list, find_phone)
        if index>=0:
            print(namecard_list[index])
        else:
            print("No data found.")
    elif menu==3:
        print("Select menu number 3")
    elif menu==4:
        print("Select menu number 4")
    elif menu==5:
        print("Select menu number 5")
        for card in namecard_list:
            print(card)
    elif menu > 5:
        print("You entered the menu incorrectly. Please re-enter.")
    elif menu==0:
        break
** If I enter a name, I get this error. **
** But when I input a number, it works normally. ** enter image description here
It's probably a data type problem, but I don't know which part is wrong. As far as I know, python does not have to declare the data type of a variable when receiving input, which is the difference from the C language. Does it change when using a class or function or when using the format function?
What code do I need to modify to make it work?
 
     
    
