Skip to main content
4 of 5
added 186 characters in body
Abhijit
  • 2.9k
  • 12
  • 26

Python 98*0.8=78.4

d=`len('X'*int("{}{:>02}".format(*(raw_input()+".0").split('.')))*2)`;print'%s.%s'%(d[:-3],d[-3:])

Python 74 (without bonus)

d=len('X'*int(raw_input().replace('.',''))*2);print'%s.%s'%(d[:-3],d[-3:])

Note

  • + is used for string concatenation
  • * used to create copies of string

Ungolfed

def tip():
    amount = raw_input()
    #Add an extra decimal point so that we can accept integer
    #amount
    amount += ".0"
    #Split the integer and decimal part
    whole, frac = amount.split('.')
    #Multiply amount by 100 :-)
    amount = "{}{:>02}".format(whole, frac)
    #Create amount copies of a character
    st = 'X'*amount
    #Double it
    st *= 2
    #Calculate the Length
    d = len(st)
    #Display the result as 3 decimal fraction
    print'%s.%s'%(d[:-3],d[-3:])

Note

In spirit of the question, I believe the following solution though follows all rules of the question is an abuse

print __import__("operator")(input(),0.2)
Abhijit
  • 2.9k
  • 12
  • 26