LearnPy Hub
← Pandas: DataFrames problems
Hard

Read a CSV

The input lines (until END) are a CSV with a header row product,price,qty. Write them to a file, load it with pd.read_csv, add a revenue column (price × qty) and print the product with the highest revenue and the total revenue.

Input

CSV lines, then END.

Output

Two lines.

Sample 1

Input
product,price,qty
pen,10,120
book,60,45
bag,900,6
END
Output
bag
9300

Sample 2

Input
product,price,qty
tea,20,1
END
Output
tea
20
solution.py
Output appears here
Read a CSV · Python practice problem · LearnPy Hub