Simple Shopping Cart
This is a simple shopping cart that allows you to add items into the cart and display the state of the cart.
Installation
To install the library run the below command in your virtual environment
pip install abdur-shopping-cart
Code style
This project makes use of black with default settings to format the code and flake 8 as a linter.
Usage
` from abdur_shopping_cart.shopping_cart import ShoppingCart
cart = ShoppingCart() print(cart.add_to_cart("cornflakes", 1)) print(cart.add_to_cart("cornflakes", 1)) print(cart.add_to_cart("weetabix", 1)) print(cart.calculate_state()) `
API
add_to_cart(product_name, quantity)
Takes in a product name as a string, quantity as an integer
Returns a success/failure
calculate_state()
Calculates the current state of the cart
Returns the product names, quantities, sub_total, tax and total
Testing
The project uses pytest to run its tests
Other
The .gitignore file was generated using gitignore.io https://www.toptal.com/developers/gitignore/
Release files for abdur-shopping-cart 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| abdur_shopping_cart-0.1.0.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abdur_shopping_cart-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.8 kB
Release files / abdur_shopping_cart-0.1.0.tar.gz
| Download URL | abdur_shopping_cart-0.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e04c089f9f9aca2fc5131776a968740a180ad11857c28ca4c062b1243faa1f53
|
|
BLAKE2b-256 checksum How to use checksums |
d0635cd833dbba188db5c0f59ce7aea935a45c5b4a4a3cc77705d2e6b4f81d99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.5 Darwin/21.6.0
|
Release files / abdur_shopping_cart-0.1.0-py3-none-any.whl
| Download URL | abdur_shopping_cart-0.1.0-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22cfc98cf5b2921a5925ba3727e11d19f514c806d1fcf124df6e1bb9ad4e2e37
|
|
BLAKE2b-256 checksum How to use checksums |
82ec7553130eb98b3d763c6dc21265dac817531ae7a08433a73d26a08125c887
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.5 Darwin/21.6.0
|