Hello: I am getting the above error while tryign to run the tower of hanoi program. The error is at line 42 highligted in red below. PLease advise #!/usr/bin/env python class Hanoi: def __init__(self, N): self.N = N try: raise ValueError(N) except ValueError, e: print "bad! value: %d" % e.value def display(): print "A" for i in range(N): print "%d\n", A[i] i += 1 print "B" for i in range(N): print "%d\n", B[i] i += 1 print "C" for i in range(N): print "%d\n", C[i] i += 1 print("-" * 10) return def move(source, dest): i = 0;j = 0 while ((source + i) == 0) and (i < N): i += 1 while ((dest + j) == 0) and (j < N): j += 1 dest + j - 1 = source + i source + i = 0 display() return dest + j - 1 def solve(n, source, dest, spare): if ( n == 1 ): move(source, dest) return solve(n-1, source, spare, dest) move(source, dest) solve(n-1, spare, dest, source) return def main(): A = [], B = [], C = [] i = 0 for i in range(N): A.append(i) i += 1 for i in range(N): B[i] = 0 i += 1 for i in range(N): C[i] = 0 i += 1 print "Solution to the tower of Hanoi problem,\ with %d disks \n" % N print "Starting state: \n" diplay() print "Subsequent states: \n\n" solve(N,A,B,C) return 0
Thank you Minnie This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
-- http://mail.python.org/mailman/listinfo/python-list