Generation

generate functionSun, 16 Jul 2023

Un almacén realiza descuentos acordes al monto de compra: Si el monto es mayor igual a $100 y menor a $200 se le realiza un descuento del 15%. Si el monto es mayor igual a $200 y menor a $200 se le realiza un descuento del 20%. Si el monto de compras es mayor igual a $300 y menor a $400 se le realiza un descuento del 30%. Si el monto es mayor igual a $400 se le descuenta un 40%. Se debe presentar el IVA y el valor a pagar del cliente.

def get_discount(total): if total >= 100 and total < 200: return total * .15 elif total >= 200 and total < 300: return total * .2 elif total >= 300 and total < 400: return total * .3 elif total >= 400: return total * .4 else: return 0 def get_total(total): discount = get_discount(total) tax = total * .12 return total - discount + tax get_total(400)

Questions about programming?Chat with your personal AI assistant