# 动物识别系统
# 自定义函数,判断有无重复元素
def judge_repeat(value, list=[]):
for i in range(0, len(list)):
if (list[i] == value):
return 1
else:
if (i != len(list) - 1):
continue
else:
return 0
# 自定义函数,对已经整理好的综合数据库real_list进行最终的结果判断
def judge_last(list):
for i in list:
if (i == '23'):
for i in list:
if (i == '12'):
for i in list:
if (i == '21'):
for i in list:
if (i == '13'):
print("黄褐色,有斑点,哺乳类,食肉类->金钱豹\n")
print("所识别的动物为金钱豹")
return 0
elif (i == '14'):
print("黄褐色,有黑色条纹,哺乳类,食肉类->虎\n")
print("所识别的动物为虎")
return 0
elif (i == '14'):
for i in list:
if (i == '24'):
print("有黑色条纹,蹄类->斑马\n")
print("所识别的动物为斑马")
return 0
elif (i == '24'):
for i in list:
if (i == '13'):
for i in list:
if (i == '15'):
for i in list:
if (i == '16'):
print("有斑点,有黑色条纹,长脖,蹄类->长颈鹿\n")
print("所识别的动物为长颈鹿")
return 0
elif (i == '20'):
for i in list:
if (i == '22'):
print("善飞,鸟类->信天翁\n")
print("所识别的动物为信天翁")
return 0
#********* Begin *********#
elif (i == '22'):
for i in list:
if (i== '15'):
for i in list:
if (i == '16'):
for i in list:
if(i == '4'):
print("不会飞,长脖,长腿,鸟类->鸵鸟\n")
print("所识别的动物为鸵鸟")
return 0
# ********* End *********#
elif (i == '4'):
for i in list:
if (i == '22'):
for i in list:
if (i == '18'):
for i in list:
if (i == '19'):
print("不会飞,会游泳,黑白二色,鸟类->企鹅\n")
print("所识别的动物企鹅")
return 0
else:
if (list.index(i) != len(list) - 1):
continue
else:
print("\n根据所给条件无法判断为何种动物")