Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

python question please show code and steps!!! Bonus Question 1 (McCarthy 91 Func

ID: 3665985 • Letter: P

Question

python question

please show code and steps!!!

Bonus Question 1 (McCarthy 91 Function) [1 point: The McCarthy 91 function is defined by: Mon) n 10 if n 100, MOn) MM(n 11) if ns100 t is an example of a recursive function where fo s not simply defined by fin-1). Write a Python function m91 (n) that implements the McCarthy 91 function. Try the function on a couple of inputs. Describe in plain words what the function computes. As a hint, distinguish if n 100 and n s 100. Put the function in the file B1 yourmacid.py. Add your observations as comments to the file. Example: 91 (103) 93

Explanation / Answer

def mc91(N):
    if N == 91:
        return N
    elif N > 100:
        print N-10
        return N-10
    elif N <= 100:
        print N
        return int(mc91(mc91(N+11)))


if __name__ == '__main__':
    n = int(raw_input('Enter a number between 0 & 2147483647: '))
    m = mc91(n)
    raw_input()

Sample output