Question 1

Solution:

def count_occur(s, c):
   """
    Input: string s, character c
    Output: integer count of the number of times c occurs in s.
   """
		if len(s) == 0:
		    return 0
    elif s[0] == c:
				return 1 + count_occur(s[1:], c)
    else:
				return count_occur(s[1:], c)

Rubric:


Question 2

Solution:

Set 1

3660CA1D-488A-47D0-BBFD-9B925B605944.jpeg

Set 2

B1071735-2656-48D7-9354-4967996521AE.jpeg

Rubrics