Computer Science, asked by idssaha000, 9 months ago

Write a Python function sumsquare(l) that takes a nonempty list of integers and returns a list [odd,even], where odd is the sum of squares all the odd numbers in l and even is the sum of squares of all the even numbers in l.

Answers

Answered by vsaravind01
0

Answer:

Get ready...

Explanation:

sumsquare(I):

even_L = [ ]

odd_L = [ ]

for x in I:

if x%2==0:

even_L.append(x)

else:

odd_L.append(x)

odd = 0

even = 0

for eve in even_L:

even = even + ((eve)*(eve))

for od in odd_L:

odd = odd + ((od)*(od))

return ([odd,even])

Similar questions