Python 3 Program to Generate A Random Number

3
437

python 3 program to generate random numbers

In this tutorial, you will learn how to generate a random number in Python. If you are new to Python, then do check out this list of best Python books which you can refer to understand the basic concepts of Python programming language.

Python 3 Program to Generate A Random Number

Generating random numbers in Python is quite simple. We will import the Random module to generate a random number between 0 to 100.  Refer to the code below.

Source code

# Program to generate a random number between 0 and 100
import random # importing the random module
print(random.randint(0,100))

Output

Python program to generate a random number

Download Python Program.

Related Python 3 Programs

  1. Python 3 Program To Add Two Matrices.
  2. Python 3 Program to Check Armstrong Number.
  3. Python 3 Program to Find the Sum of Natural Numbers.
  4. Python 3 Program To Find The Factorial Of A Number.
  5. Python 3 Program to Find Largest Among Three Numbers.
  6. Python 3 Program to Check Leap Year.
  7. Python 3 Program To Check If Number Is Positive Or Negative.
  8. Python 3 Program To Add Two Numbers.
  9. Python 3 Program to Find the Square Root of A Number.
  10. Python 3 Program to Calculate The Area of a Triangle.