I would like to understand how consecutive numbers could be found in a list. This is the code I’ve written so far:
v = []
while True:
n = int(input("Insert a number (0 for exit) -> "))
if n == 0: break
v.append(n)
for i in range(len(v)):
if v[i] - 1 == v[i - 1]:
print(v[i - 1])
but this code doesn't print the last number of v[i], can someone help me?