Python

Python Program to Generate a Random Number1 min read

Write a program to Generate a Random Number in Python

Code:




Output:

The code you provided is a simple Python program that generates a random integer between 0 and 100.

The program starts by importing the random module, which is a standard library that provides functions for generating random numbers.

Then, the program uses the randint() function from the random module, which generates a random integer within a given range. In this case, the function is passed the arguments 0 and 100, so it generates a random integer between 0 and 100, inclusive.

The program then uses the print() function to output the randomly generated integer to the console.

The output will be a random integer between 0 and 100, every time the program is run. For example, the output could be “23” or “74” or any other number between 0 and 100.

Leave a Comment