#Week 9 Ch 13, Ex:6 ##Written by Greg Lamb #Last Modified on 05/13/2015 # This program asks user to enter values for m and n # Then it runs those two values through a function named “Ackermann Function” # There is much to be said about this function: Look it up on Wikipedia def ack(m, n): if m == 0: return n+1 if n == 0: return ack(m-1, 1) return ack(m-1, ack(m, n-1)) x=int(input("Enter the number 2\n")) y=int(input("Enter the number 3\n")) print("The value entered for x is: {}\nThe value entered for y is: {}\nThe number of iterations is: {} ".format(x, y, (ack(x, y))))
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question