Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

awk 'BEGIN{FS=",";IGNORECASE=1}

{
if($3=="Finance" || $3=="finance" ||$3=="FINANCE")
{
sum=$4+sum
count=count+1
}
}END{
if(count>0)
{
print("Total Asset Price = "sum)
}
else
{
print("No Asset Found")
}
}'

========================================================================
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Book:
def __init__(self,pages,price,author,bookId,title):
self.pages = pages
self.price = price
self.author = author
self.bookId = bookId
self.title = title
class BookStore:
def __init__(self,bookStoreName,bookList):
self.bookStoreName = bookStoreName
self.bookList = bookList
def findMinimumBookID(self):
min_obj = min(self.bookList, key=lambda x:x.bookId)
return min_obj
def sortbookById(self):
ans1 = sorted(self.bookList, key=lambda x:x.bookId)
ans2 = []
for i in ans1:
ans2.append(i.bookId)
if len(ans2)==0:
return None
else:
return ans2

count = int(input())
bookList = []
for i in range(count):
pages = int(input())
price = int(input())
author = input()
bookId = int(input())
title = input()
b = Book(pages,price,author,bookId,title)
bookList.append(b)
bs = BookStore("ABC",bookList)
x = bs.findMinimumBookID()
y = bs.sortbookById()
print(x.pages)
print(x.price)
print(x.author)
print(x.bookId)
print(x.title)
for i in range(len(y)):
print(y[i])

You might also like