Write in python please



Initialize a loop that runs twice (for
x
in range(2)).Inside the loop, read two integers
F
andD
from the input.Initialize two lists,
summ
andvec
, both of lengthF
, filled with zeros.Start a nested loop that runs
D
times.a. Read a list of integers
f
from the input.b. Initialize
idx
to 0.c. Iterate over the elements in the list
f
:i. Add the current element to the corresponding index in the
summ
list.ii. Increment
idx
by 1.d. Append the sum of the elements in list
f
to thevec
list.Initialize a variable
ans
to 0.Iterate over the elements in the concatenation of lists
vec
andsumm
.a. If the current element is divisible by 13 (i.e.,
i % 13 == 0
), add the integer division of the element by 13 toans
.Print the value of
ans
.
Step by step
Solved in 3 steps with 1 images









