A while loop uses a conditional to determine when to exit. The loop must be coded to ensure that the conditional will become False at some point, or it will never terminate.
while conditional: block1 else: #optional block2
As for the for loop, colons and indentations are required. The optional else clause is executed if and only if the conditional becomes False, which for a while loop is normal termination.
x=-20 y=-10 while x<0 and y<0: x=10-y y=y+1 z=0 print(x,y,z)
Modify each for loop in the previous section’s exercise to use a while loop instead.