Desktop Products

 Coding Problem Keys 

 Desktop Products 

 Problem Statement 

A company DigiComparts manufactures 52 types of unique products for laptop and desktop computers. It manufactures 10 types of laptop products and 42 types of desktop products. Each product manufactured by the company has a unique productID from a-z and and A-Z. The laptop products have productIDs (a, i, e, o, u, A, I, E, O, U) while the rest of the productIDs are assigned to the desktop products. The company manager wishes to find the sales data for the desktop products.

Given a list of productIDs of the sales of the last N products, write an algorithm to help the manager find the productIDs of the desktop products.

 Input Format 

The first line of the input consists of an integer numOfProducts, representing the number of products to be considered in the sales data (N).
The second line consists of N space-separated characters - productID1, productID2, ... , productIDN representing the productIDs of the sales of last N products. 

 Output Format 

Print an integer representing the number of desktop products among the given sales data.

 Constraints 

 numOfProducts  10

 Example 1 

 Input 

6
a v i k e l

 Output 

3

 Explanation 

The productIDs of the desktop products in the sales data are [v, k, l].
So, the output is 3.

 Example 2 

 Input 

9
s d h a j m e k p

 Output 

7

 Explanation 

The productIDs of the desktop products in the sales data are [s, d, h, j, m, k, p].
So, the output is 7.

 Solution 

 Programming Language: Python 3 Language 

"""
productID representing the product IDs of the sales.
"""
def calculateDesktopProductIDs(productID):
    # Write your code here
    numOfDesktopProducts = 0
    laptopProductIDs = ['a','i','e','o','u','A','I','E','O','U']
    for i in productID:
        if i not in laptopProductIDs:
            numOfDesktopProducts += 1
    return numOfDesktopProducts

def main():
    # input for productID
    productID = []
    productID_size = int(input())
    productID = list(map(str,input().split()))

    result = calculateDesktopProductIDs(productID)
    print(result)

if __name__ == "__main__":
    main()

# Published By PKJCODERS

 (Note: Incase If the code doesn't Pass the output kindly comment us with your feedback to help us improvise.) 

Comments

Popular Posts

Toggle Consonants Adjacent to Vowels

String Pattern - Inverted U

Top Scoring Batsman - TEST ODI 20-20

Mango Distribution

Java - Method Overriding - Area

Microsoft