while True:
ID = input('请输入18位的身份证号码: ')
#
if len(ID) != 18:
print('输入的身份证号码不是18个字符,请重新输入')
break
#
if len(ID) == 18:
year =ID[6:10]
month = ID[10:12]
date = ID[12:14]
birthy=year+'-'+month+'-'+date
sex=ID[16:17]
if int(sex)%2:
sex='你是男性'
else:
sex='你是女性'
print('出生日期为:'+birthy)
print(sex)
print()