Ребята запутался в циклах в конце
user_str = input('Enter your e-mail or phone number or your full name:')
user_str = user_str.strip()
res = ''
signs = '()- '
if ('@' in user_str) and ('.' in user_str):
raw_list = user_str.split('@')
if len(raw_list) == 2:
if raw_list[0].isalpha() and len(raw_list[0]) > 2:
part_raw = raw_list[1].split('.')
if (part_raw[0].isalpha() and len(part_raw[0]) > 2) and (
part_raw[1].isalpha() and len(part_raw[1]) > 2):
res = 'Email'
elif len(user_str) == 3:
if user_str.isalpha():
name = user_str[0]
scnd_name = user_str[1]
surname = user_str[2]
if (name[0].isupper() and len(name) > 2) and (scnd_name[0].isupper() and len(scnd_name) > 2) and (
surname[0].isupper() and len(surname) > 2):
res = 'full name'
else:
for i in user_str:
if i in signs:
user_str = user_str.replace(i, '')
if user_str[0] == '+' and len(user_str) == 13:
res = 'phone'
elif user_str[0] == '0' and len(user_str) == 10:
res = 'phone'
if res:
print(f'\'{user_str}\' is {res}')
else:
continue
question = input('Would you like to restart (Y/N)?') # тут хотел создать цикл, что бы в случае ввода ерунды повторялся вопрос, но запутался в циклах
if question.upper() == 'Y':
continue
elif question.upper() == 'N':
break
else:
continue