You are on page 1of 1

Que. 62.

Generate 50 random numbers within a range 500 to 1000 and


write them to file Write NumRandom.txt.

Program:

from random import randint


fp1 = open("WriteNumRandom.txt","w")
for x in range(51):
x = randint(500,1000)
x = str(x)
fp1.write(x + " ")
fp1.close()

output:

You might also like