CSC 171 - Introduction to Computer Programming

Lab Assignment #11 - More Work with Strings

Due Friday, October 20, 2023

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:

Given the s = "It is imperative that we do that which is right and never which it is wrong":

Evaluate:

  1. s.replace("which", "what")
  2. s.replace("is", "was", 6)
  3. t = s[0:16]
  4. t.ljust(24)
  5. t.rjust(26)
  6. t.center(28)
  7. s.count("is")
  8. s.startswith("It")

[Back to the Lab Assignment List]