Question: Question 2 : Recursion ( 2 0 marks ) Implement the following functions using recursion in the file recursion.py . Please check test _ recursion.py

Question 2: Recursion (20 marks)
Implement the following functions using recursion in the file recursion.py. Please check
test_recursion.py to understand the expected behavior of each function. There are no marks
for non-recursive implementations or functions that rely on sorting.
a. reorder(list_of_letters)(10 marks)
This function takes a Python list of one-character strings and should reorder the
elements so that all vowels precede all consonants and return the modified list. If the
arguments elements are such that vowels precede consonants, then the order of the
elements must not be modified. The function must not change the given argument
(list_of_letters).
b. is_alternating(numbers)(10 marks)
This function should return True if the string numbers consists of alternating 0s and 1s
and False otherwise.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!