Simple Dice Game Using Python

In this tutorial we will make a simple dice game using python. So, let’s get started.

To make this game we need one module:

• random

We need to use a random module to generate numbers between 1 to 6 each time. to get more info about the random module, you can check its documentation.

We start by importing the randint method or function from a random module. then we used while loop to continuously run our code (based on user input roll). we run our loop again and again when the input is “y”.

``````from random import randint

roll = "y"
while roll == "y":
print("Rolling the dices...")
dice1 = randint(1,6)
dice2 = randint(1,6)
print(dice1, dice2)

roll = input("Roll Again?")``````

This is the recent 3 outputs.

Related post: How to Make a Simple Calculator Using Python

Still wondering how to get started with python?

Check out our exclusive book,

How to Make a Simple Calculator Using Python

Spread the loveIn this tutorial, I’ll show you how to make a simple calculator using python. Let’s make a simple calculator using python. this will be a simple python script,…

Rock Paper Scissors Game Using Python

Spread the loveIn this tutorial I’ll show you how to make a simple rock paper scissors game using python. Here we need one module: random We need to use a…