Skip to content
Advertisement

Comparing 2 randomly generated lists in python

I am trying to make a program that will generate a list filled with randomly generated characters, then repeatedly randomizing another until both of them match up.

However, when I run the following program, even at the lowest value, it will continuously run, forever.

JavaScript

Advertisement

Answer

You keep on appending to your second list in your while loop. Simple reset your list during each iteration:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement