Created
November 20, 2019 11:52
-
-
Save Bablzz/d851f94967d723c6272baa2499261049 to your computer and use it in GitHub Desktop.
Tower of Hanoi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def solve(n, a, b, c): | |
if n > 0: | |
solve(n - 1, a, c, b) | |
print('Move disk from ' + a + ' to disk ' + b) | |
solve(n - 1, c, b, a) | |
solve(3, '1', '2', '3') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment