from random import randint def roll_dice(): return (randint(1, 6), randint(1, 6)) roll_val = (0, 1) k = 0 while roll_val[1] != roll_val[0]: k += 1 roll_val = roll_dice() print(f"You rolled a {roll_val[0]} and a {roll_val[1]}") print(f"Congratulations! You rolled double {roll_val[0]}s! It took you {k} rolls")