Question
Write a function in python defcount_starts(text): Consider text representing a list of strings. The function should check the starting character of each string in the
Write a function in python defcount_starts(text): Consider text representing a list of strings. The function should check the starting character of each string in the list, construct and return a dictionary that uses the leading characters of each string in text as keys and an integer number as their values to report how many strings start with that character.
o text: a list of non-empty strings; text can be empty.
o Return value: a dictionary reporting the occurrences of leading characters in the list of
strings.
Examples:
o count_starts(['time','after','time']) {'t': 2, 'a': 1}
o count_starts(["a","b","r","a","c","a","d","a","b","r","a") {'r': 2, 'd': 1, 'c': 1, 'b': 2, 'a': 5}
o count_starts([]) {}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started