Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is for python Write a recursive function that finds the smallest number in a list of numbers. Your function should: be named smallest_recursive take
This is for python
Write a recursive function that finds the smallest number in a list of numbers. Your function should: be named smallest_recursive take 1 argument, a list of numbers return 1 number, the smallest number in the list HINT: You are allowed to use the min function here, which takes two arguments and retruns the minimum. For example min(3,7) returns 3. You cannot assume that the list is sorted and you should not be sorting it. Graded Read Only import numpy as np np.random.seed(89547) 11 = np.random.randint(-100, 100, 100) a1 = np. sort(11)[0] np. testing.assert_allclose(a1, smallest_recursive(11. tolist())) np.random.seed (485) Read Only 12 = np.random.randint(0, 1000, 100) a2 = np. sort(12)[0] np.testing.assert_allclose(a2, smallest_recursive(12. tolist()))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started