1

Hello I'm new at python and want to find good solution for I think easy problem. I have main for loop and inside it I have some (about 5) while loops. In some cases I need to move to next for loop item. There is a way to do that without putting a lot of breaks ?

Code looks like :

for x in list:
    #Do some stuff
    {...}
    while loop:
        #do some stuff
        {...}
        while loop:
            #do some stuff
            {...}
            while loop:
                #do some stuff
                {...}
                while loop:
                    #do some stuff
                    if:
                        #here move to next item in for loop
                    else:
                        #other operations
4
  • 1
    Try to think about your code and see if you can avoid having so many nested loops. Commented Jan 29, 2018 at 9:29
  • @MartijnPieters I wrote that in for loop here is just one for loop Commented Jan 29, 2018 at 9:30
  • Yup, I realised and removed that part. Commented Jan 29, 2018 at 9:30
  • Possible answer here: Naming loops in python Commented Jan 29, 2018 at 9:32

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.