# Setting new values for variables in a string

Now you are going to generate variations on this note for two different students, with a dotted line between the two messages.

You want the output:

 1 2 3 Hi Aditya. You achieved a score of 98. It's True that I enjoyed having you as a student. -------------------------------------------------------------------------------- Hi Sue Troublemaker. You achieved a score of 46. 

You write the following code:

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 name = 'Aditya' score = 98 liked = True message = "Hi %s. You achieved a score of %d." % (name, score) extra = "It's %s that I enjoyed having you as a student." % liked print message, extra print "-" * 80 name = 'Sue Troublemaker' score = 46 liked = False print message 

Does it give you the desired output?

×