- Head of Sales Team Wipro previous year coding question


Problem: 

The company trader mart manufactures different type of software products. They deliver their products to their are N clients. Whenever the company fullfills the complete order of a client the order ID generated is the concatenation of the number of product deliver for every committed product type. The head of the sales team wishes to find the client wise data for the total number product any type deliver to the respective client. 

Write an algorithm for the head of the sales team to calculate the total number of products any type deliver to the respective client  

Input: 

The first line of the input consists of an integer numOfClient representing the number of client

The second line consist of n space separated integer representing the ordered delivered


Sample input: 

4

43 345 20 987


Sample output:

7 12 2 24

Explanation: 

The client 0  order two type of products deliver to him/her is 7

Program:

n=int(input())
list1=list(map(int,input().split()))

for item in list1:
    list2=list(str(item))
    list3=[int(item) for item in list2]
    print(sum(list3),end=" ")


3 Comments

Post a Comment

Previous Post Next Post