Consider a Python function: def spam(n): if n


Consider a

Python

function:


def spam(n):
    if n <=>
        return 0
    else:
        return 1 + spam(n // 2)


1. What is returned by spam(16)?


2. What is the value of n when the base case is reached if the original call to the function is spam(16)?


3. What is returned by spam(9)?


4. What is the value of n when the base case is reached if the original call to the function is spam(9)?


5. What is returned by spam(-1)?


6. What is the value of n when the base case is reached if the original call to the function is spam(-1)?



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here