'How do you iterate by increasing odd numbers?

start = 370

for number in range(73):
    print(f"{number+1}. {(start)}")
    start = start * 1 +1

I am trying to add by increasing odd numbers (1,3,5,7,9, etc.). I am starting out with 370, 371, 374.... I want the output to last until the 73rd term



Solution 1:[1]

One way to generate odd numbers is to use the 3-argument form of range():

start = 370

for number in range(1, 2*73 + 1, 2):
    start += number
    print(start)

Gives:

371
374
379
...
5411
5554
5699

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1