Answer :
let q be the variable to be computed associated with h. the code is given below as
q=0 / initial value assigned is 0
for i in range(1,h+1): / for loop is formatted with range 1 t0 h+1
q+=i**2 / sum q is computed as square of i
q=0 / initial value assigned is 0
for i in range(1,h+1): / for loop is formatted with range 1 t0 h+1
q+=i**2 / sum q is computed as square of i