python写的一个骰子程序,python写骰子程序,import rando


import randomdef rolldice():    return random.randint(1, 6)def main():    while True:        stop = input("Roll the dice? y/n: ")        if stop and stop[0].lower() == "n":            break        # otherwise we roll the dice        dice1 = rolldice()        dice2 = rolldice()        print("You rolled %d, %d" %(dice1, dice2))        if dice1 == dice2:            print("You rolled a double, you win!!!!")        print()

评论关闭