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

1
  • It is suggested to use str.format() instead of %. Commented Nov 25, 2013 at 0:45

1 Answer 1

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])
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.