Using Methods

1.

   a.'HELLO'
   b.'happy birthday!'
   c.'wEEEeeeeEEEeeeeEEE'
   d.True
   e.1
   f.True
   g.False
   h.'Hello Python'
   i.'Hello Python! Hello World!'

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

3. 'tomato'.find('o')

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

5. 'avocado'.find('o', 'avocado'.find('o') + 1)

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

7. strip

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')

9. 'I love {0}!'.format(season)

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

11.

   a.'boolean'.capitalize()
   b.'C02 H20'.find('0')
   c.'C02 H20'.find('0', 'C02 H20'.find('0') + 1)
   d.'Boolean'[0].islower()
   e."MoNDaY".lower().capitalize()
   f." Monday".lstrip()

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)