144k views
0 votes
Write a program where you print this sequence.

1

3

5

7

9

1 Answer

5 votes

init = 1

choice = int(input("How far into the sequence would you like to go to? "))

i = 0

while i < choice:

print(init)

init += 2

i += 1

If you enter 5, you'll get 1,3,5,7,9. You can also go to whatever place in the sequence you want. I wrote my code in python 3.8. Hope this helps

User Martin Wunderlich
by
5.2k points