Lab – Working With Files

Open a file cust.csv :

And orders file:

1.  Create an interactive app: ask for customer name (using input function) and display the total orders for the customer

  • Create a function getid(name) -> return customer id by name
  • Create a function getorders(custid) -> return list of all orders for customer id (try to use filter function with lambda expression)
  • Create a function calcsum(listoforders) -> return total sum of orders  
  • Write the main loop and use the above functions

2.  Create a file summery.txt with customer name and total orders: