Question: LANGUAGE: PYTHON i. Q6. Develop a class Shopping Cart that supports these methods for an online shopping website: (10-marks) _init__(): Initializes the items (list) in

LANGUAGE: PYTHON
i. Q6. Develop a class Shopping Cart that supports these methods for an online shopping website: (10-marks) _init__(): Initializes the items (list) in the Shopping Cart to the value of the input argument, or an empty list if no input argument is given add_item(): Takes an item as input and adds it the item list remove_item(): Takes an item as input and removes it from the item list if present check_out(): Returns the items present in the ShoppingCart ii. iii. iv. >>> x = ShoppingCart ("kurta') >>> x.add_item ('shirt') >>> x.add_item ('tie') >>> x.remove_item( shirt') >>> x.add_item( 'belt') >>> x.check_out() kurta tie belt Apart from the conventional operations, the class should also have a class variable keeping the total count of shopping carts active within the system. The count of the shopping_cart_count variable should be increased whenever a new cart is created. The count should be reduced whenever a cart is checked out
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
