Using Methods

2. 'tomato'.count('o')

4. 'tomato'.find('o', 'tomato'.find('o') + 1)

6. 'runner'.replace('n', 'b')

8. a. fruit.count('p') then fruit.find('p', 3)
b. fruit.upper() then 'PINEAPPLE'.swapcase() then fruit.count('pineapple')
c. fruit.swapcase() then fruit.lower() then fruit.replace('PINEAPPLE', 'pineapple')

10. 'The sides have lengths {0}, {1}, and {2}.'.format(side1, side2, side3)

12.

def total_occurrences(s1, s2, ch):
    """ (str, str, str) -> int

    Precondition: len(ch) == 1

    Return the total number of times that ch occurs in s1 and s2.

    >>> total_occurrences('color', 'yellow', 'l')
    3
    >>> total_occurrences('red', 'blue', 'l')
    1
    >>> total_occurrences('green', 'purple', 'b')
    0
    """ 
    return s1.count(ch) + s2.count(ch)