No project description provided
Project description
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/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file abdur_shopping_cart-0.1.0.tar.gz
.
File metadata
- Download URL: abdur_shopping_cart-0.1.0.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.5 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e04c089f9f9aca2fc5131776a968740a180ad11857c28ca4c062b1243faa1f53 |
|
MD5 | e74876f1d389d89f9a7e84c21104e74a |
|
BLAKE2b-256 | d0635cd833dbba188db5c0f59ce7aea935a45c5b4a4a3cc77705d2e6b4f81d99 |
File details
Details for the file abdur_shopping_cart-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: abdur_shopping_cart-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.5 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22cfc98cf5b2921a5925ba3727e11d19f514c806d1fcf124df6e1bb9ad4e2e37 |
|
MD5 | 4e692af5ecb9efb93a2f29a456c11384 |
|
BLAKE2b-256 | 82ec7553130eb98b3d763c6dc21265dac817531ae7a08433a73d26a08125c887 |