how to make multiple place holders in a string with %s python code example

Example 1: how to make multiple place holders in a string with %s python

a = 'bananas'
b = 'apples'
c = 'peaches'
print('I like to eat %s, %s and %s' %(a, b, c))
#Prints: I like to eat bananas, apples and peaches

Example 2: how to make a string with many variables in python

var1 = “awesome”
var2 = “ever”
print “Codecademy has the most %s coding lessons %s!” % (var1, var2)
# displays: “Codecademy has the most awesome coding lessons ever!”

Tags:

Misc Example