We have just some string methods, a special type of function that canr r"owned" by a string. The ones that we learned about are:
s.replace(t, u) - replaces occurrences of t
within s with us.ljust(x) - left-justifies s assuming that
it is x characters longss.rjust(x) - right-justifies s assuming that
it is x characters longss.center(x) - centers s assuming that it is
x characters longsas.count(t) - gives the number of occurrences of the string t within the large string ss.startswith() - True if s starts with the
string t; otherwise False s.endswith() - True if s ends with the
string t; otherwise FalseGiven the s = "It is imperative that we do that which is right and never which it is wrong":
Evaluate:
s.replace("which", "what")s.replace("is", "was", 6)t = s[0:16]t.ljust(24)t.rjust(26)t.center(28)s.count("is")s.startswith("It")