Remember, we used the
% operator to replace the
%s placeholders with the variables in parentheses.
name = "Mike" print "Hello %s" % (name)
You need the same number of
%s terms in a string as the number of variables in parentheses:
print "The %s who %s %s!" % ("Knights", "say", "Ni") # This will print "The Knights who say Ni!"
Now it’s your turn! We have
___ in the code to show you what you need to change!
- Inside the string, replace the three
- After the string but before the three variables, replace the final
- Hit Run.