Skip to content

Instantly share code, notes, and snippets.

@JohnsonLuu
Last active June 2, 2020 16:50
Show Gist options
  • Save JohnsonLuu/99440371382e9d7790a4965a49beea2b to your computer and use it in GitHub Desktop.
Save JohnsonLuu/99440371382e9d7790a4965a49beea2b to your computer and use it in GitHub Desktop.
"""
Create a function named more_than_n that has three parameters named lst, item, and n.
The function should return True if item appears in the list more than n times. The function should return False otherwise.
"""
#Write your function here
def more_than_n(lst, item, n):
if (lst.count(item) > n):
return True
else:
return False
#Uncomment the line below when your function is done
print(more_than_n([2, 4, 6, 2, 3, 2, 1, 2], 2, 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment