Add Total Column
orders has columns item, price and qty (whole numbers). Return a DataFrame with all three columns plus a new column total equal to price * qty, rows in their original order.
Example 1
orders {"item":["pen","cup"],"price":[2,5],"qty":[3,2]}
returns {"columns":["item","price","qty","total"],"rows":[["pen",2,3,6],["cup",5,2,10]]}
Totals are 6 and 10.
Constraints
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.