-5

I have searched on the google but I did not find correct answer

I have the following code:

print("i have %d years old" % (15))

Is there a perfect references to learn how to use above way fully ?

Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253
  • 3
    I don't think you searched very hard... By the way, asking for references (links, books, tutorials, etc) to external resources is considered off-topic for SO and is grounds to have your question closed. – Hack-R Jul 09 '16 at 15:12
  • 2
    1. Strings: http://stackoverflow.com/questions/31964930/python-string-formatting-with-percent-sign 2. Modulo / numeric http://stackoverflow.com/questions/961344/what-does-the-percentage-sign-mean-in-python-3-1 – Hack-R Jul 09 '16 at 15:15
  • @Hack-R: You are being a little hasty. The question here is how to use `%`. The question you linked is asking why a particular use of it throws a syntax error. – zondo Jul 09 '16 at 15:17
  • 1
    A better dupe target is https://stackoverflow.com/questions/1238306/what-does-do-to-strings-in-python – zondo Jul 09 '16 at 15:19
  • 2
    Possible duplicate of [Whats does % mean in Python? Have trouble understanding](http://stackoverflow.com/questions/10338011/whats-does-mean-in-python-have-trouble-understanding) – zondo Jul 09 '16 at 15:25

1 Answers1

-1

"%" is actually the modulus operator but it can also be used to format strings. Learn more about it here: link

ssmid
  • 350
  • 2
  • 12