Page 1 of 1

QUESTION 4 (16 MARKS) Given the following code snippet: 1. 2. 3. 4. 5. 6. 7. 56 8. 9. listA= [1, 3, 8, 12, 5, 2,7] max=L

Posted: Tue Jul 05, 2022 10:25 am
by answerhappygod
Question 4 16 Marks Given The Following Code Snippet 1 2 3 4 5 6 7 56 8 9 Lista 1 3 8 12 5 2 7 Max L 1
Question 4 16 Marks Given The Following Code Snippet 1 2 3 4 5 6 7 56 8 9 Lista 1 3 8 12 5 2 7 Max L 1 (32.17 KiB) Viewed 11 times
QUESTION 4 (16 MARKS) Given the following code snippet: 1. 2. 3. 4. 5. 6. 7. 56 8. 9. listA= [1, 3, 8, 12, 5, 2,7] max=ListA[0] for i in range (1, len (listA)): if (max< listA): max= listA print (max) Output: 12 Examine the code snippet again and discuss whether the code is functional programming or not by providing how should the code follows the rule of functional programming. (6 markah/marks) Construct a new function and apply recursive concepts to replace the code snippet. (10 markah/marks)