import random while True: num = random.randint(1,6) #print(num) if num==6: print('丟到6,遊戲結束') break