0

I am trying to format the amount of hundreds using %d

amount = [10]
print "Hundreds %d"(amount[0])

I am then getting a TypeError saying 'str' is not callable. This is my first time using this formatting, so any help would be greatly appreciated. :D

bob
  • 135
  • 1
  • 4
  • 14
  • It is [suggested](http://stackoverflow.com/questions/5082452/python-string-formatting-vs-format) to use `str.format()` instead of `%`. – Nil Nov 25 '13 at 00:45

1 Answers1

3

You are missing the modulo (%) operator:

print "Hundreds %d" % (amount[0])

Note however that the modern way to do this is to use str.format:

print "Hundreds {}".format(amount[0])