'''
输入一个list和n,看看list中是否有2个数的和等于n
'''
def is_rotation(alist, n):
if alist is None or n is None:
return None
dict1 = {}
for i in alist:
if dict1.get(n-i): #字典的get方法,或获取不到,会返回None,而不是索引那样报错
return True
dict1[i] = True
return False
alist = [1,2,3,4,5]
n = 5
print(is_rotation(alist, n))