Learn
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!"
Instructions
1.
Now it’s your turn! We have ___
in the code to show you what you need to change!
- Inside the string, replace the three
___
with%s
. - After the string but before the three variables, replace the final
___
with a%
. - Hit Run.
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.