3
answers
0
watching
499
views
4 May 2018
Part (b) [3 MARKS] Complete the function body according to its docstring description. You will be marked only on the parts that need to be different from (a). def count_letter_case_mutate (L): " (list of list of str) -> None Type Precondition: each str in L is non-empty and contains only alphabetic characters Replace each item in L with a two-item tuple in which the first item is the number of words in the list at the corresponding index of L that start with a lowercase letter and the second item is the number of words in the list at the corresponding index of L that start with an uppercase letter >>> data = [['apple', 'Banana'], ['PeAr'], [], ['PEACH', 'aprICot', 'plum']] >>> count_letter_case_mutate (data) >>> data [(1, 1), (0, 1), (0, 0), (2, 1)]
Part (b) [3 MARKS] Complete the function body according to its docstring description. You will be marked only on the parts that need to be different from (a). def count_letter_case_mutate (L): " (list of list of str) -> None Type Precondition: each str in L is non-empty and contains only alphabetic characters Replace each item in L with a two-item tuple in which the first item is the number of words in the list at the corresponding index of L that start with a lowercase letter and the second item is the number of words in the list at the corresponding index of L that start with an uppercase letter >>> data = [['apple', 'Banana'], ['PeAr'], [], ['PEACH', 'aprICot', 'plum']] >>> count_letter_case_mutate (data) >>> data [(1, 1), (0, 1), (0, 0), (2, 1)]
28 Jun 2023
gloryolalere280Lv10
20 Nov 2022
Already have an account? Log in
Nestor RutherfordLv2
6 May 2018
Already have an account? Log in