I am trying to teach my friend Python and showed him 3 methods of printing variables of different types without the need for converting them to strings first, but he wants to know which one should he use and I don't know as I have not used Python in a long time so hopefully you can help us out:
print("There are %d people in total" % num_people)
or
print("There are", num_people, "people in total")
or
print("There are {} people in total".format(num_people))
I know that the format method can do other, more powerful, string manipulation operations but other then that I am not sure which is the preferred method to use. I don't know why the first method exists as the 2nd seems simpler.
Any thoughts on this? Thank you!