How to stop the whole loop?
<p>I have a problem in the loop below for python.</p>

<p>It doesn't stop as soon as totalout=4, but only when the whole loop for scorein is over. (i.e. the thrid loop)</p>

<p>For example, if the totalout=4 in scorein number 2, it runs the loop till it reaches 10</p>

<pre><code>#global value   
totalturn=0
totalscorein=0
totalout=0

def main

  numberofturn=int(input("Number of score:"))

  no_turn=['1','2','3','4','5','6','7','8','9','10'] 
    #while loop condition    
    while totalturn&lt;numberofturn and totalout&lt;10:

            #increasement
            totalscore+=1

            #for loop for score
            for t in range(1,numberofturn+1):
                turns=s*1

                print("\n\n\nThe turn"+no_turn[t]+":",turns)

                #for loop for number to appear from list
                for c in range (10):

                    #list for random number to appear
                    numscore = ['1','2','3','4','5','6','7','8','9','o']

                    #random choice from numscore list to appear
                    from random import choice
                    scorein=choice(numscore)

                    print ("\n\nScores :",scorein)




                    if scorein.isdigit():
                        totalscorein=totalscorein+int(scorein)               


                    if scorein.isalpha():
                        totalout+=1



                    if totalturn==numberofturn:
                        print("\nTotal turn played:",totalturn)


                    elif totalout==4:

                        print("\nTotal turns played",totalturn)
                        break

                    else:

                        print("")
</code></pre>
