Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create TowerOfHanoi #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions StringLenght
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

test_list = [ 1, 4, 5, 7, 8 ]

print ("The list is : " + str(test_list))


counter = 0
for i in test_list:


counter = counter + 1


print ("Length of list using naive method is : " + str(counter))
16 changes: 16 additions & 0 deletions TowerofHanoi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
filter_none
edit
play_arrow

brightness_5

def TowerOfHanoi(n , from_rod, to_rod, aux_rod):
if n == 1:
print "Move disk 1 from rod",from_rod,"to rod",to_rod
return
TowerOfHanoi(n-1, from_rod, aux_rod, to_rod)
print "Move disk",n,"from rod",from_rod,"to rod",to_rod
TowerOfHanoi(n-1, aux_rod, to_rod, from_rod)

n = 4
TowerOfHanoi(n, \'A\', \'C\', \'B\')