In this python basic program, we will generate random numbers using random library.
Steps to solve the program
- Import random library.
- We are going to generate 5 random numbers, so use for loop with range function to generate 5 number.
- Use random.random() to generate random numbers inside the loop.
- Print the output.
import random
for i in range(5):
print(random.random())
Output :
0.9199240457263513
0.9004451014782473
0.7153068440492277
0.6578686372362937
0.9954018599145891