1.

Write a program to calculate and display the sum of all the odd numbers in the list.

Answer» pos = 0

sum = 0

while pos < len (L):

if L[pos] %2 = = 1 :

sum = sum + L [pos]

pos = pos + 1

print sum


Discussion

No Comment Found