#write a function digits that has one parameter - positive integer #the function finds and returns sum of all digits, average of all digits, #and the number of digits #write main that reads a sequence of positive integers #first negative or zero terminates the input #for each input number use function digits to find sum of all digits, #average of all digits, #and the number of digits def digits(num): total=0 counter=0 while(num>0): d=num%10 total=total+d counter=counter+1 num=num//10 ave=total/counter return total, ave, counter def main(): num=int(input("enter the number ")) while(num>0): total, ave, counter=digits(num) print(total, ave, counter) num=int(input("enter the number ")) main()