In this post, you will learn how to find heads or tails using the random function and below is the source code of the program and also below is the video format of the post, check it out ????????
Heads or tails in python source code
Firstly, I used the random module and if you don’t know about the random module [click here]
Then I used the randit function, which selects a random integer and then I wrote the if statement and entered the variable equals to 1 and I print the if statement as heads and then I print the else statement as tails.
* Random function does not work python 3 and below so, you need to install the random function using pip install random
Also Read: Celsius to Fahrenheit in python
Also Read: Random module in python