Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions