Facebook
From Social Butterfly, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Capacious Stork - go back
Embed
Viewing differences between Untitled and Re: Untitled
# function 3
def num_occur(s, c):
num_occur(c, s):
    """takes a single character c and an arbitrary string s 
    and returns the number of times that c occurs in s"""
    lc = ([x for x in if x == s])
c])
    return len(lc)

# function 4
def most_occur(c, words): 
    """ takes a single character c and a list of one or 
    more strings called words and returns the string in 
    the list with the most occurrences of c"""
    scored_occur = [[num_occur(words, c), [[num_occur(c, words), x] for x in words]
    return scored_occur