O
O
Omolix2020-09-12 12:26:00
Python
Omolix, 2020-09-12 12:26:00

How to increase the number of circles during the cycle?

I need to loop, but I don't know the exact number of laps. How to make a loop that will increase the number of circles in the loop itself, but with a limit?
Now my code looks like this:

c = 0
  nado = 54
  for c in range(nado):
    wres = res + '&offset=' + str(offset)
    print(wres)
    offset += 1
    nado += 1
    if (nado == countm):
      exit()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2020-09-12
@bacon

If the limit is greater than nado, then use the while loop, otherwise do break, not exit. Well, offset and nado, in fact the same thing, you can get by with one variable.

A
afterters, 2020-09-13
@efters

Use while

i = 0
repeats = 10

while i < repeats:
    print(i)
    repeats = int(input())
    i += 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question