Wednesday, May 31, 2017

Smallest Discount item

Choose item with the smallest discount offered among n items given

Input Format 

First line will contain the value of  n
Followed by n lines contains item name, cost and discount percent separated by spaces.

Output Format

The name of the item which offers least discount 


a = int(input())
c = 999999
for i in range (a):
    b = input().split()
    d = int(b[1])*(int(b[2])/100)
    if c>d:
        c = d
        s = b[0]

print(s)

Share: