Question: Python: for example, a solution that prints for 4 disks: Move disk 1 from a to c Move disk 2 from a to b Move

Python:
for example, a solution that prints for 4 disks:
Move disk 1 from a to c
Move disk 2 from a to b
Move disk 1 from c to b
Move disk 3 from a to c
Move disk 1 from b to a
Move disk 2 from b to c
Move disk 1 from a to c
but it really does not show you how the pegs look like. I want you to write a program that displays this:
% python3 hanoi_displays_moves.py
enter nr of disks: 3
a: [1,2,3]
b: []
c: []
=========
Move disk 1 from a to c
a: [2,3]
b: []
c: [1]
=========
Move disk 2 from a to b
a: [3]
b: [2]
c: [1]
=========
Move disk 1 from c to b
a: [3]
b: [1,2]
c: []
=========
Move disk 3 from a to c
a: []
b: [1,2]
c: [3]
=========
Move disk 1 from b to a
a: [1]
b: [2]
c: [3]
=========
Move disk 2 from b to c
a: [1]
b: []
c: [2,3]
=========
Move disk 1 from a to c
a: []
b: []
c: [1,2,3]
=========
%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!