I'm trying to find the 5 most recent years without repeating digits, and I keep getting the error 'int' object has no attribute '__getitem__'
This is my code and I so far -I can't figure out what's wrong with it. Any explanation as to how to fix it is appreciated.
def find_year():
start = 2015
years = []
while len(years) < 5:
if start[0] == start[1]:
return False
elif start[0] == start[2]:
return False
elif start[0] == start[3]:
return False
elif start[1] == start[2]:
return False
elif start[1] == start[3]:
return False
elif start[2] == start[3]:
return False
else:
years.append(start)
start -= 1
else:
print years
find_year()