The following is a working example. With comments in the code so you can better understand each step.
# import required to use randint
import random
# holds the last number to be randomly generated
previous_number = None
while True: # infinite loop
# generates a random number between 1 and 6
num = random.randint(1, 6)
# check if the last number was 6 and current number is 6
if previous_number == 6 and num == 6:
# if the above is true then break out the loop
break
# store the latest number and start the loop again
previous_number = num
1
solved how to tell an infinite loop to end once one number repeats twice in a row (in python 3.4)