f = open('file.txt', 'r')
newfile = []
lines = f.readlines()
number = lines[0][-3:-1]
for i in range(int(number)):
    string = '0' + str(i + 1) + ' ' + number
if i + 1 != int(number):
    string += '\n'
if string not in lines:
    newfile.append('missing\n')
else:
    newfile.append(string)
f.close()
f = open('file.txt', 'w')
f.writelines(newfile)
f.close()
python: number sequence