How to start for loop from the beginning of the list on which we are iterating if some condition in the loop turns True(see below) :     def fi_da_prfac(var):
        fac = []
        prfac = []
        z = range(2, (var/2)+1)
        z.append(var)
        for t in z:
            if var == t:
                prfac.append(t)
                z = range(2, (var/2)+1)
                z.append(var)
                break
            else:
                if  var % int(t) == 0:
                    prfac.append(t)
                    var = var/t
                    del z
                    z = range(2, (var/2)+1)
                    z.append(var)
                    del t

        return prfac

I am a beginner at coding. I am trying to write a code to find the Prime factorisation of a given number. If we analyze the code, what I want to do is that if I find a factor, I want to start the for loop again ie. start the for loop from t = 2. I didnt find any way to do it. So I deleted "t" at the end. However the code isnt giving the desired output. I tried a lot to debug it but couldn't. Please help

