Mar-16-2020, 09:46 AM
Hey guys
How to break nested loop?
How to break nested loop?
Loop inside loop inside loop
|
||
Mar-16-2020, 09:46 AM
Hey guys
How to break nested loop?
can you show sample code and explain better what you want (e.g. break out of the inner most loop into upper level, or break out of all netsed loops, etc.), because your setup is not very clear. Otherwise the answer is to use
break .
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
Mar-16-2020, 09:57 AM
Maybe one of my earlier answers to similar question helps.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Mar-16-2020, 09:58 AM
(Mar-16-2020, 09:52 AM)buran Wrote: can you show sample code and explain better what you want (e.g. break out of the inner most loop into upper level, or break out of all netsed loops, etc.), because your setup is not very clear. Otherwise the answer is to use elements = "qwertyuiop" elements_list = list(elements) password = input("enter: ") for a in elements_list: ////for b in elements_list: ////////for c in elements_list: ////////////print(a+b+c) ////////////if a+b+c == password: ////////////////break
Please, use proper tags when post code, traceback, output, etc.
See BBcode help for more info. what do you want to achieve? Why do you do all these weird things? If you want to check string is present in list of strings:
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs | ||
|