I want to test if a list contains consecutive integers. But if the next element is duplicate it show avoid it.
For e.g.
raw_list_1 = [400, 401, 402] # this is valid
raw_list_2 = [400, 401, 403] # this is in-valid
raw_list_3 = [400, 401, 401, 401, 402, 403] # this is valid
in the case of raw_list_3 we got the pattern where number can repeat in sequential manner.
my code
raw_list_1 = [400, 401, 402] # this is valid
raw_list_2 = [400, 401, 403] # this is in-valid
raw_list_3 = [400, 401, 401, 401, 402, 403] # this is valid
is_valid_list = sorted(raw_list_3) == list(range(min(raw_list_3), max(raw_list_3)+1))
print(is_valid_list)
False
#################