nico
nico

Reputation: 25

How to write a loop inside a loop with python?

Just started to learn programming.. here my question, using Python how I can write a while loop inside another while loop??

while A > 10:
B +=10

    while x < 12:
       x +=1
       A =  bla bla some function depending on B

how is the correct syntax??

Thanks a Lot!

Upvotes: 1

Views: 584

Answers (1)

Christian Tapia
Christian Tapia

Reputation: 34146

This is a nested while inside another one. Remember to indent correctly.

while A > 10:
    B += 10
    while x < 12:
        x += 1
        A = bla bla some function depending on B

Upvotes: 5

Related Questions