main.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# Python code to generate # random numbers and # append them to a list import random # Function to generate # and append them # start = starting range, # end = ending range # num = number of # elements needs to be appended def Rand(start, end, num): res = [] for j in range(num): res.append(random.randint(start, end)) return res # Driver Code num = 10 start = 20 end = 40 print(Rand(start, end, num)) |