Question: Within a Python file named recursion fun.py , write the following functions: ( a ) ( 4 points ) power ( b , n )
Within a Python file named recursion fun.py write the following functions:
a points powerb n
Returns the value of bn for any numeric b and any integer n including negative integers
Do not use any loops, and do not use any builtin ways of computing powers. This function
must be recursive. Hint: this is extremely similar to the power function that we wrote
in class.
b points count negativesstuff
Returns how many negative integers ie are contained in stuff. You may assume
that stuff is a list of integers. Do not use any loops, and do not use any builtin ways of
searching a list. This function must be recursive.
c points all shortstuff
Returns whether or not stuff contains only short strings. Well define a short string
as being characters or less in length. If stuff is empty, this should return True. You
may assume that stuff is a list of strings. Do not use any loops, and do not use any
builtin ways of searching a list. This function must be recursive.
d points binary searchstuff target
Returns the index of target within the list stuff if it exists, or False if it doesnt exist.
You may assume that stuff is a sorted list of integers, and target is an integer. Do not
use any loops, and do not use any builtin ways of searching a list. This must be done
recursively; you can write a recursive helper function if needed.
e points After your function definitions in recursion fun.py write some tests for your
functions. Each test should call the function with specific arguments and print the return
value. Be sure to test at least the following scenarios:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
