I am trying to figure out how to count to a certain integer (like a range) alternating between two different digits, for example 2 and 3. Thus, the output will be 2 5 7 10 12 15, etc.
I started trying to modify a simple while loop as follows to take two values:
a = 0 while a < 100: a = a + 2 + 3 print(a, end=' ')
But it just ends up counting to 100 by 5.
I have tried number ranges for loops and modules like itertools to try to figure out a way to do this, and I'm completely at a dead end.
I did a search after searching on this subject, and everything I can find is counted by a single number with loops and ranges.
python loops iteration
Bruce l
source share