from random import random
n=10
a = int(input("a = "))
b = int(input("b = "))
mas = []
for i in range(n):
c = int(random() * 50)
mas.append(c)
print(mas)
k = 0
if (mas[i]>=a)and(mas[i]<=b):
k=k+1
print(k)
Пример:
a = 10
b = 20
[3, 11, 9, 16, 31, 48, 18, 47, 40, 46]
3
from random import random
n=10
a = int(input("a = "))
b = int(input("b = "))
mas = []
for i in range(n):
c = int(random() * 50)
mas.append(c)
print(mas)
k = 0
for i in range(n):
if (mas[i]>=a)and(mas[i]<=b):
k=k+1
print(k)
Пример:
a = 10
b = 20
[3, 11, 9, 16, 31, 48, 18, 47, 40, 46]
3