Welcome to the Shopping Cart exercise! In this exercise, you will be working with a basic shopping cart implementation in Python. The ShoppingCart
class allows you to add items, remove items, calculate statistics, and perform various operations on a shopping cart.
Your task is to complete the following steps:
- Fork this repository to your GitHub account.
- Clone the forked repository to your local machine.
- Open the
shopping_cart.py
file and implement the missing functionalities marked with# TODO
comments. - Write test cases in the
test_shopping_cart.py
file to ensure the correctness of the implemented functionalities. - Run the test cases using
python test_shopping_cart.py
and make sure all tests pass. - Make any necessary modifications and improvements to the code.
- Commit and push your changes to your GitHub repository.
- Submit a pull request to the original repository to share your solution.
The repository contains the following files:
shopping_cart.py
: The main Python file that contains the incompleteShoppingCart
class. You need to complete the missing functionalities.test_shopping_cart.py
: The unit tests for theShoppingCart
class. You should write additional test cases to cover all scenarios.README.md
: This file, providing instructions and information about the exercise.
To complete this exercise, you need to have the following:
- Python (version 3.6 or above) installed on your machine.
- A text editor or an integrated development environment (IDE) to write and modify Python code.
- Basic knowledge of Python and object-oriented programming concepts.
- Familiarity with writing and running test cases using the
unittest
framework.
- Read the code comments in the
shopping_cart.py
file to understand the required functionalities. - Follow the test-driven development (TDD) approach by writing test cases first and then implementing the required functionalities.
- Write clear and concise code with proper variable names and comments to enhance code readability.
- Feel free to add any additional features or improvements to the shopping cart implementation.
- If you face any issues or have any questions, don't hesitate to ask for help.
- Python
unittest
documentation: https://docs.python.org/3/library/unittest.html - Git and GitHub documentation: https://docs.github.com/en
Good luck with the exercise! Happy coding!