Skip to content

Commit

Permalink
Update Python Program for Tower of Hanoi.py
Browse files Browse the repository at this point in the history
Updated print statement to match current syntax
  • Loading branch information
Piombacciaio authored Jul 30, 2023
1 parent 1f2ea76 commit f6bbb37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Python Program for Tower of Hanoi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Recursive Python function to solve the tower of hanoi
def TowerOfHanoi(n , source, destination, auxiliary):
if n==1:
print "Move disk 1 from source",source,"to destination",destination
print("Move disk 1 from source ",source," to destination ",destination)
return
TowerOfHanoi(n-1, source, auxiliary, destination)
print "Move disk",n,"from source",source,"to destination",destination
print("Move disk ",n," from source ",source," to destination ",destination)
TowerOfHanoi(n-1, auxiliary, destination, source)
n = 4
TowerOfHanoi(n,'A','B','C')

0 comments on commit f6bbb37

Please sign in to comment.