#让用户输入一个宠物名字,然后检查该名字是否在宠物列表中myPets = ['Zophie', 'Pooka', 'Fat-tail']print('Enter a pet name:')name = input()if name not in myPets: print('I do not have a pet named ' + name)else: print(name + ' is my pet.')
本文共 266 字,大约阅读时间需要 1 分钟。
#让用户输入一个宠物名字,然后检查该名字是否在宠物列表中myPets = ['Zophie', 'Pooka', 'Fat-tail']print('Enter a pet name:')name = input()if name not in myPets: print('I do not have a pet named ' + name)else: print(name + ' is my pet.')
转载于:https://www.cnblogs.com/chenxi188/p/10524017.html