Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created February 6, 2017 22:41
Show Gist options
  • Save shamikalashawn/d854a5f15a23a7dc6ef2968c2a60dc53 to your computer and use it in GitHub Desktop.
Save shamikalashawn/d854a5f15a23a7dc6ef2968c2a60dc53 to your computer and use it in GitHub Desktop.
Given a string and a letter, a number of times that letter appears in the string is returned.
def count(string, letter):
thecount = 0
for item in string:
if item == letter:
thecount = thecount + 1
print (thecount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment