Advertisement
Guest User

inflacion_por_producto

a guest
May 25th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. def inflacion_por_producto(precio_inicial,precio_final):
  2.     '''Devuelve la inflación de un producto.'''
  3.     try:
  4.         inflacion = 100*((precio_final - precio_inicial) / precio_inicial)
  5.         return (str(round(inflacion, 2))+'%')
  6.     except ZeroDivisionError:
  7.         print('El precio inicial no puede ser 0!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement