Computer Science, asked by rmanojdivya000, 9 months ago

Convert the following for loop into while loop:
for k in range(10,20,5) :
print (k).

Answers

Answered by harsh85642
31

Explanation:

for k in range(1,20,5):

print(k)

k=k+1

Answered by adventureisland
9

A for loop is a programming technique that allows you to repeat a sequence of events. As soon as a condition is true, we can execute a collection of comments in the while loop.

In For loop :

  • A for loop is a programming technique that allows you to repeat a sequence of events.
  • This is similar to the iterator method in other object-oriented programming languages rather than the for keyword in other languages.

for k in range(10,20,5) :

print (k).

In while loop:

  • As soon as a condition is true, we can execute a collection of comments in the while loop.
  • The while loop requires the availability of relevant variables; in this case, we must define an additional indexing variable, I, which will be set to 1.

i=10

while i<=20:

      i=i+5

      print(i)

i=i+1

Similar questions