Let’s suppose we have a small retail store that sells a vari…
Let’s suppose we have a small retail store that sells a variety of items. To track performance, we need a running total of all items sold each week so we can estimate which products are the most frequently purchased. Create a function called soldF that accepts a flexible number of arguments using **kwargs. This function should update both the name of the item sold and the cumulative quantity sold. Complete the following expression: # start with a blank dictionary ‘total’total = {}# part 1: Define a function named soldF that accepts **kwargs as its argument# Complete this function using a for loop and an if-else statement as follows: # part 2: Write a for loop that iterates over each ‘item’ in kwargs # part 3a: Use an if condition — if the item name already exists in ‘total’, # update its quantity to reflect the cumulative count # Step 3b: Otherwise, add the item to the dictionary with its initial quantity # Step 4: Return the updated dictionary as the output # validation ## The items and quantities sold in the first weektotal = soldF(drink_coffee= 63,cosmetic= 12, ready_to_eat = 47,candy_snack= 167,medications= 27)## The items and quantities sold in the second weektotal = soldF(medications= 14,drink_coffee= 102,ready_to_eat = 32,candy_snack= 53, basic_groceries =5 )total It returns the following output: {‘drink_coffee’: 165, ‘cosmetic’: 12, ‘ready_to_eat’: 79, ‘candy_snack’: 220, ‘medications’: 41, ‘basic_groceries’: 5}