Write a program die_function1.py
that has a die()
function that calculates a random number between 1 and 6 (inclusive) and prints that number out.
You'll need to import the random
module, and then calculate a random integer using one of several strategies:
int(random.random() * 6) + 1
or
random.randrange(6) + 1
The main()
program should call the die()
function a few times so several different random numbers are displayed.
Sample outputs (from multiple times running the program):
I have rolled a virtual six-sided die to get the result 3
I have rolled a virtual six-sided die to get the result 6
I have rolled a virtual six-sided die to get the result 1