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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…