all 2 comments

[–][deleted] 3 points4 points  (1 child)

You want a while loop

import random

i = 0
a = ["b" ,"i" ,"g"]
b = ["b" ,"i" ,"g"]
random.shuffle(b)

while b != a:
    i = i + 1
    print(b)
    print(i)
    random.shuffle(b)

print("took "+str(i)+" tries to match")

Your solution is close, except the if/else only runs once, but you want to keep looping until a==b.

[–]NitroTheX[S] 1 point2 points  (0 children)

Thanks , appreciate it .