Ex38.py while loop as a for loop

hello everybody.

Anybody any thoughts on how to write this while loop as a for loop ?

while len(stuff) != 10:
next_one = more_stuff.pop()
print("Adding: ", next_one)
stuff.append(next_one)
print(“There’s %d items now.” % len(stuff))

stuff is a list

I can test length of list with an if statement and len(stuff)
and populate until we have 10 elements.

Anybody else have any thoughts ?

Well, there are probably a few ways… for example:

for _ in range(10):
    next_one = more_stuff.pop()
    stuff.append(next_one)