Creating a Dice Rolling Simulator using Python3

 In this tutorial, a dice rolling simulator, as in applications installed in smartphones, will be made using Python3 for anybody to try.

"""This program is built to roll a die endlessly until you stop it."""

import random 
x = "y"
while x == "y":
    n = random.randint(1,6)
    if n == 1:
        print ("    ")
        print ("  * ")
        print ("    ")
    elif n == 2:
        print (" * ")
        print ("    ")
        print ("     * ")
    elif n == 3:
        print ("   * ")
        print ("   * ")
        print ("   * ")
    elif n == 4:
        print ("   *    * ")
        print ("           ")
        print ("   *    * ")
    elif n == 5:
        print ("   *    * ")
        print ("      *     ")
        print ("   *    * ")
    elif n == 6:
        print ("   *    * ")
        print ("   *    * ")
        print ("   *    * ")
    
    

    x = input("Enter 'y' to roll again : ")
    print ("\n")

0 Comments