
# Python 3.x
import numpy
# Вводим массив случайных целых чисел диапазона от -1000 до 1000.
array=numpy.array((numpy.random.random(30) * 2 - 1) * 1000, numpy.int)
print(array)
# Считаем сумму среза массива по условию нечетности элементов.
sumary=numpy.sum(array[array % 2 != 0])
print("Sumary: ", sumary)
#
A=int(input("A: "))
indexs=numpy.where(array > A)[0]
result=[str(index) for index in indexs] # для метода join требуются строковые значения.
print(f"Here indexs, more that {A}: ", ', '.join(result))
#
k=int(input("k: "))
positives=array[array >= 0]
required=positives[positives % k == 0]
print(len(required), f" positive items divisible {k}")
Поделитесь своими знаниями, ответьте на вопрос:
function pr(a:longint ):boolean;
var i: longint;
begin
if a<2 then pr:=false
else
begin
pr:=true;
for i:=2 to round(sqrt(a)) do
if a mod i=0 then pr:=false;
end;
end;
var k,n,x: longint;
b: boolean;
begin
b:=false;
readln(k,n);
if (k>=2) and ( n>=k) and (n<=100000) then for x:=k to n do if (x mod 10=3) and (pr(x)=true) then
begin
b:=true;
write(x,' ');
end;
if b=false then writeln(0);
end.