Strings

string Methods


Use string methods to print the following strings. Remember that methods work by adding the function to the end of the object name using a ., like

mystring = 'Hello World'
print mystring.lower()
  1. 'species' in all capital letters
  2. 'gcagtctgaggattccaccttctacctgggagagaggacatactatatcgcagcagtggaggtggaatgg' with all of the occurences of 'a' replaced with 'A'
  3. "    Thank goodness it's Friday" without the leading white space (i.e., without the spaces before "Thank")
  4. The number of 'a's in 'gccgatgtacatggaatatacttttcaggaaacacatatctgtggagagg'.
[click here for output]