I made a python scrambler but whenever I run my program, it strangely does not print anything, however, when I close my program, the python dialogue says the program is still running. This is my code:
def differ(a1, a2):
diff = 0
for i in range(len(a2)):
if a1[i] != a2[i]:
diff += 1
return diff
import random
def scramble(arr):
scrambled = arr
while differ(arr, scrambled) < len(arr)-1:
popped = scrambled.pop(random.randrange(1, len(scrambled)))
scrambled.insert(popped, 0)
return scrambled
print(scramble([1,2,3]))
does anybody know what's currently happening and knows how to fix it and possibly cleanse the code out?