Wednesday, 14 February 2024

Class 11 CS Practical - 42

 

42 - Write a program in Python to create a list of 10 random numbers between 1 to 100.


import random as r

L=[]

for i in range(0,10):

    a=r.randrange(1,100)

    L.append(a)

print("List of 10 random numbers between 1 to 100:")

print(L)



Output:

List of 10 random numbers between 1 to 100:

[60, 67, 55, 66, 85, 82, 73, 67, 62, 57]


No comments:

Post a Comment