using recursion python Consider the English alphabet consisting of 26 lowercase letters: a, b, c, · · ·, x, y, z. • To this order, letters appear earlier are defined smaller. For example, the letter a is smaller than the letter b, and z is the largest letter since it appears last in the alphabet. • The least letter of an English word is the smallest letter that appears in that word. For example, the least letter of “Saturday” is “a”, and the least letter of “hello” is “e”. You are asked to write a program consisting of a function and a main interface as follows. (a) function recur_least_letters(l): Goal: collects all the least letters of words in list l (one least letter for each word) and returns the string of the obtained least letters in the order that the corresponding words appear in list l. • Input: a list l of English words • Output: string of all the least letters of words appearing in list l • Example: input: l = [‘today’, ‘is’, ‘saturday’] → output: “aia” Recursion is strictly required. (a) Base case: write return statements for the cases that len(l) = 0 and/or len(l) = 1 (b) Recursive relation: if len(l) ≥ 2, then split l into two smaller lists - one contains the first element of l and the other contains the rest of l. Then reduce the task for l to the analogous tasks for the two smaller lists. Hints. You may want to use methods such as list(), sorted(), etc. (b) main interface • Input: define the list variable input_s = [‘today’, ‘is’, ‘saturday’] • Output: apply the function recur_least_letters to input_s and print out the output, which should be “aia’.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

using recursion python

Consider the English alphabet consisting of 26 lowercase letters: a, b, c, · · ·, x, y, z.
• To this order, letters appear earlier are defined smaller. For example, the letter a is
smaller than the letter b, and z is the largest letter since it appears last in the alphabet.
• The least letter of an English word is the smallest letter that appears in that word. For
example, the least letter of “Saturday” is “a”, and the least letter of “hello” is “e”.
You are asked to write a program consisting of a function and a main interface as follows.
(a) function recur_least_letters(l):
Goal: collects all the least letters of words in list l (one least letter for each word)
and returns the string of the obtained least letters in the order that the corresponding
words appear in list l.
• Input: a list l of English words
• Output: string of all the least letters of words appearing in list l
• Example: input: l = [‘today’, ‘is’, ‘saturday’]
→ output: “aia”
Recursion is strictly required.
(a) Base case: write return statements for the cases that len(l) = 0 and/or len(l) = 1
(b) Recursive relation: if len(l) ≥ 2, then split l into two smaller lists - one
contains the first element of l and the other contains the rest of l. Then reduce the
task for l to the analogous tasks for the two smaller lists.
Hints. You may want to use methods such as list(), sorted(), etc.
(b) main interface
• Input: define the list variable input_s = [‘today’, ‘is’, ‘saturday’]
• Output: apply the function recur_least_letters to input_s and print out the output,
which should be “aia’.  

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY