Machine Problem 2
Create a Python script that will generate random n integers from a given start and end of a range.
Sample Output:
Value for n :5
Value for start: 1
Value for end : 10
10 8 7 8 3
import random
print('Value for n: ', end='')
n = int(input())
print('Value for start: ', end='')
start = int(input())
print('Value for end: ', end='')
finish = int(input())
for i in range(n):
rnd = random.randint(start, finish)
print(f'{rnd} ', end='')
Comments
Leave a comment