import os
names = []
def normalize_name(first, last):
first = first.strip().capitalize()
last = last.strip().capitalize()
full_name = f"{first} {last}"
if full_name in names:
print("\033[31mЭто имя уже есть в списке!\033[0m")
return False
return full_name
def print_names():
print("\n\033[1;36mТекущий список имен:\033[0m")
for i in range(len(names)):
print(f"{i+1}. {names[i]}")
print()
while True:
os.system("cls")
print("\033[1;35mДобавление нового имени\033[0m")
first_name = input("Введите имя: ")
last_name = input("Введите фамилию: ")
full_name = normalize_name(first_name, last_name)
if full_name:
names.append(full_name)
print(f"\033[32mДобавлено: {full_name}\033[0m")
print_names()
choice = input("Хотите добавить еще одно имя? (да/нет): ").lower()
if choice != 'да':
print("\033[1;35mИтоговый список имен:\033[0m")
print_names()
print("До свидания!")
break