I am looking for an output in the following manner: If my inputs are
starting_value = 8
ending_value = 20
I want output as
8 13 ##8+(5) = 13
14 19 ##start of next iteration should be 13+1 = 14, and then 14+(5)
I wrote a for loop for this:
for i in range(8,20):
start = i
end = i+5
print(start,end)
i = end+1
But I'm getting wrong result:
8 13
9 14
10 15
11 16
12 17
13 18
14 19
15 20
16 21
17 22
18 23
19 24
Is there something wrong in my for loop, Any better pythonic way to do this?
itakes a new value from therange(8, 20)iterator on each iteration. The statementi = end + 1doesn't do anything.forin python is afor-eachloop & not a traditional C for-loop.