from random import randint n = 0 for i in range(1,1001): a = randint(1,6) b = randint(1,6) s = a + b if s == 7: n += 1 f = n/1000 print(f)