seed: curriculum content
This commit is contained in:
16
1.solar-system/3.strings/06.the-counter/starter/starter.py
Normal file
16
1.solar-system/3.strings/06.the-counter/starter/starter.py
Normal file
@@ -0,0 +1,16 @@
|
||||
def count(s):
|
||||
"""Count three things in a sentence and return a dict.
|
||||
|
||||
Keys:
|
||||
"length" — total characters in s (including spaces)
|
||||
"words" — number of whitespace-separated words
|
||||
"a_count" — count of lowercase 'a's after lowercasing s
|
||||
|
||||
Helpers:
|
||||
len(s) — char count
|
||||
len(s.split()) — word count
|
||||
s.lower().count("a") — number of 'a's, case-insensitive
|
||||
|
||||
count("Hello andromeda") -> {"length": 15, "words": 2, "a_count": 2}
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user