Question 1 Not complete Marked out of 1.50 Flag question Define a function named get_sum_consonants (words_list) which t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 1 Not complete Marked out of 1.50 Flag question Define a function named get_sum_consonants (words_list) which t

Post by answerhappygod »

Question 1 Not Complete Marked Out Of 1 50 Flag Question Define A Function Named Get Sum Consonants Words List Which T 1
Question 1 Not Complete Marked Out Of 1 50 Flag Question Define A Function Named Get Sum Consonants Words List Which T 1 (38.11 KiB) Viewed 21 times
Question 1 Not complete Marked out of 1.50 Flag question Define a function named get_sum_consonants (words_list) which takes a list of words as a parameter and returns the total number of consonants in the parameter list. For example: data = ['this', 'is', 'a', 'very', 'short'] print (get_sum_consonants (data)) produces: 11 (i.e. 3 + 1 + 0 + 3 + 4 = 11) Note that there are 21 consonant characters (B, C, D, F, G, H, J, K, L, M, N, P, Q, R, S, T, V, W, X, Y and Z), but your code should be able to handle both upper and lower case characters in the words. The program should return 0 if the parameter is an empty list or there are no consonant characters in the parameter list. For example: Test Result print (get_sum_consonants (['life', 'is', 'a', 'long', 'journey', 'abc123', 'list1'])) 15 print (get_sum_consonants (['apple', 'banana', 'grapes', '345'])) 10 print (get_sum_consonants(['io', 'ae'])) 0 Answer: (penalty regime: 0 %) 1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply