In this exercise
you're going to create a virtual coin toss program
and it's randomly going to tell the user
whether if they got "Heads" or "Tails."
It's important that the first letter should be capitalized
and spelled exactly as in the example
because we're going to test for it.
And there's many ways that you could do this,
but to practice creating random numbers
you're going to generate a random number,
either a 0 or 1, and then use that number
to print out "Heads" or "Tails"
where 1 is Heads and 0 is Tails.
So the Example Output should just be Heads or Tails
and that's all there is to it.
So have a go at this.
So the first step to use the random module
is to actually import the random module,
and we do that on line one, "import random".
And then we use a function inside the random module
called randint(), which generates a random integer,
a random whole number
and we get to define what that whole number can be.
And we do that by writing 0, 1
so either 0 or 1.
And then we assign the value that gets generated
from this random coin-toss
into a variable which I've called random_side.
Now finally, because we know
that the random_side can only be either 0 or 1,
we do a conditional check where we check to see
if it is one then we're going print out "Heads",
and if it's zero we're going to print out "Tails".