Created
August 25, 2020 18:49
-
-
Save willy-r/9df38e4fc5a76c44cad10fb46fb5f732 to your computer and use it in GitHub Desktop.
Given a string s and a character c, return the number of occurrences of c in s.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def num_chars(s: str, c: str): | |
"""Returns the number of occurrences of c in s.""" | |
return s.lower().count(c.lower()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment