formatting output

The format method is an easy way to output data.

In your print string, use {} as placeholders which are filled by the variables in the .format() part of the code.

meaning_life = 42
author = "Douglas Adams"

print("According to {}, the meaning of Life, the Universe and Everything is {}.".format(author, meaning_life))
Comments