1) Count total number of numbers in the list
2) Sum and Average of all the numbers in the list
3) Count and sum of all the odd numbers in the list
4) Count and sum of all the even numbers in the list
5) Find the largest number in the list
6) Find the smallest number in the list
Display all the values with appropriate titles.
listNo = [6,8,10,44,33,21,7,1,0,2]
c = 0
s = 0
avg = 0
sOdd = 0
sEven = 0
cOdd = 0
cEven = 0
for i in listNo :
c += 1
s = s+i
avg = s/c
if i % 2 == 0 :
sEven = sEven + i
cEven = cEven + 1
else :
sOdd = sOdd + i
cOdd = cOdd + 1
print ("total number of numbers in the list : ", c)
print("sum of all numbers : ",s)
print("average of all numbers : ",avg)
print("count odd numbers : ",cOdd)
print("sum of odd numbers : ",sOdd)
print("count even numbers : ",cEven)
print("sum of odd numbers : ",sEven)
print("largest number in the list : " ,max(listNo))
print("smallest number in the list : ",min(listNo))