Giter VIP home page Giter VIP logo

discountcalc's Introduction

Calculate Discount This module provides a function to calculate the final price after applying a discount to an original price.

Installation No installation is required, as this is a pure Python module.

Usage To use the calculate_discount function, simply call it with the original price and the discount percentage as arguments:

import calculate_discount

final_price = calculate_discount.calculate_discount(100, 20) print(final_price) The calculate_discount function takes two arguments:

price: The original price of an item. discount_percent: The discount percentage as a float between 0 and 100. If the discount percentage is 20% or higher, the function applies the discount and returns the final price. Otherwise, the function returns the original price.

The calculate_discount function returns the final price as a float.

Example Here's an example usage of the calculate_discount function:

import calculate_discount

final_price = calculate_discount.calculate_discount(100, 20) print(final_price) This will print 80.0, which is the final price after applying a 20% discount to an original price of 100.

Testing To run the tests for this module, execute the following command in the terminal:

python -m unittest discover This will run all the tests in the test_calculate_discount.py file.

License This module is licensed under the MIT License.

discountcalc's People

Contributors

muthomi196 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.