Python Program Freezes computer -
i have been programming in python little while now, , decided teach friend well. asked him make method return list of factors of number, gave me script little inefficient still looked should have worked me. when run program freezes both , computer (i have top of line gaming pc don't think using many resources). showed him how fix it, still cannot pinpoint causing problem. here code, time! def factors(numb): facs = [] in range(1,int(numb // 2)): if numb % == 0: facs.append(i) in facs: facs.append((numb / i)) return facs.sort() p.s. never throws error, after having been let run while. in python 3.4 the problem in fragment: for in facs: facs.append((numb / i)) you have self-incrementing sequence here.