import random def fun(): a = 0 b = 1 total = 0 while a != b: a = random.randint(0,9) b = random.randint(0,9) total += 1 print(a,b,total) else: print('='*30) return total f = 0 while f < 30: f = fun() else: print(f)