Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def price_format_gateway(price):
    price = "{0:.2f}".format(price)
    price = price.split(".")
    try:
      if len(price[1]) > 2:
        decimals = str(price[1][0:2])
      else:
        decimals = price[1]
    except IndexError:
      pass
    
    print str(price[0]) + str(decimals)
    
    
    
price_format_gateway(10)
price_format_gateway(10.1)
price_format_gateway(10.15765)