Skip to content

Instantly share code, notes, and snippets.

@nietzscheson
Created December 7, 2021 18:33
Show Gist options
  • Save nietzscheson/5c5a0dbfcab60dd203db7cb8e20e5f96 to your computer and use it in GitHub Desktop.
Save nietzscheson/5c5a0dbfcab60dd203db7cb8e20e5f96 to your computer and use it in GitHub Desktop.
from functools import reduce
import logging
logger = logging.getLogger(__name__)
def quote(subtotal, vat, payment_quantity):
###
logger.INFO("Create a Quote")
total = subtotal + (subtotal * vat)
###
logger.INFO(f"The total is: {total}")
values = [round(total/payment_quantity,2)] * payment_quantity
# values_total = reduce(lambda a=0, e=0: a+e, values)
values_total = sum(values)
rest = values_total - total
values[-1] = round(values[-1] - rest,2)
###
logger.INFO(f"The values are: {values}")
return values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment