# Why isn't this loop working?

 0 I'm trying to solve the Suduko problem by using a nested loop, and the zip function. When I run the initial list/matrix through my loop, it returns the correct values. However, when I run the zipped version of the list through the exact same loop (or a copy redefined as a separate function), it tells me it can't pop because there aren't any values in the list. I really don't understand why that is. By creating a new list with the the zip function, shouldn't it have values in it? And, when I run my code through the visual interpreter at: http://people.csail.mit.edu/pgbovine/python/tutor.html#mode=edit, it even displays the zipped matrix as a list. I'd post the code here, but I know we're not supposed to do that. asked 12 Mar '12, 10:38 marimbadaddy 77●1●8 accept rate: 20% 1 With all due respect, why are you trying to incorporate functions not yet presented in order to solve the homework? Especially if they are increasing the difficulty of assignment? (12 Mar '12, 12:56) pmoriarty It seemed that the zip function was a quick and easy way to get the data represented by the columns, as we had the data listed in rows. Also, it seems logical that if one sums both the columns and the rows, then compares these sums, it is the easiest way to test whatever size Suduko square. Just testing the rows wouldn't work because you can have all of correct numbers in the puzzle, but not in the correct order. (12 Mar '12, 13:17) marimbadaddy 1 Have you tried printing the zipped list to verify that it does have values (in the interpreter where you are having problems)? (12 Mar '12, 13:36) Kenneth I. L... I agree with others here. You should try to stick with the functions we know as of now. Even though some other functions could make the problem a lot easier, we are not trying to make things easy, we are trying to learn. Making a somewhat complicated but interesting and nuanced solution is what we are aiming for. We aren't looking for the best possible way to check if something is a sudoku, we are leaning how to execute various random tasks for the sake of learning. (12 Mar '12, 13:45) Josh Melnick When dealing with sums of columns and rows, make sure your code will handle something like [[1,4,4,1],[4,1,1,4],[4,1,1,4],[1,4,4,1]] (12 Mar '12, 14:02) jane

Question text:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "Title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported

×15,276
×195
×46
×13