CodeSolved

A comprehensive source of programming questions and exercises

Generate random numbers to the desired number

Practice Easy 15/ Download 2216 Views

Write a program that receives the number of random numbers and its interval from the user and produces the number of random numbers.


Example:

Enter a number: 10
Enter min: 1
Enter max: 10
9
4
6
5
2
8
1
7
9
2

13 Answers

This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
This answer is only visible to premium members
This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error'
alert(msg) 
This answer is only visible to premium members
This answer is only visible to premium members

This answer is only visible to premium members

Subscription is currently unavailable.
import random
tedad=int(input('tedade adad haye random ra nam bebarid:'))
a=int(input('yek adad vared konid:'))
b=int(input('yek adad vared konid:'))
g=[random.randint(a,b) for i in range(tedad)]
print(g)
Maryam.n Download Python
import numpy as np
count = int(input("Enter a number: "))
min_value = int(input("Enter min: "))
max_value = int(input("Enter max: "))

random_numbers = np.random.randint(min_value, max_value + 1, count)

for num in random_numbers:
    print(num)
Roghaye.m Download Python
import random
rep = int(input('enter number of repeat:'))
min = int(input('min:'))
max = int(input('max:'))
for i in range(1,rep+1):
	print(random.randrange(min,max),end='  ')
Alvandsina Download Python
import random
num=int(input("set number count: "))
min =int(input("set minmum: "))
max= int(input("set maximum: "))
if(min>max):
    temp=min
    min=max
    max=temp
for i in range(num):
   print(random.randint(min,max))
Saeeda33 Download Python
num1 = int(input("number 1 : "))
num2 = int(input("number 2 : "))
count = int(input("Count : "))
list_count = []
import random
for x in range(count) :
    r = random.randint(num1,num2)
    list_count.append(r)
print(list_count)
Emrimo Download Python
from random import randint
try:
    a = int(input("Enter a number: "))
    b = int(input("Enter min: "))#min
    c = int(input("Enter max:"))#max
except ValueError:
    print("Erorr: input add nist")

for i in range(a):
    print(randint(b, c))
import random
numbers = int(input('enter the  a number >> '))
min_num = int(input(" enter min num : >> "))
max_num = int(input(" enter the max number: >> "))
for i in range(numbers):
    x = random.randrange(min_num, max_num)
    print(x)
                    
User 131 Download Python
<< Previous page 1 2 Next page >>

Submit answer

Submitting answers is currently unavailable.

Related content

Detection using AI
×
×
Close