Dice game in python

Dice game in python

In this article you'll learn how to develop python dice game using while loop.

We're going to create two variable holding a random generated number from python.

Th game will run when the two die is equal to 6 or it'll continue running until it gets double six()

import random

while True:
    input("Press enter to play dice: ")

    die1 = random.randint(1,6)
    die2 = random.randint(1,6)

    print(f"you rolled: {die1} : {die2}")

    if die1 == die2 == 6:
        print("Congratulations. you won")
        break
    else:
        print( Sorry, roll the dice again")

Credit to my teacher Mr Atha