On 30/9/2013 15:54, melw...@gmail.com wrote: > Lol, im starting to get the hang out of, onto the next hurdle, i looked up > the error and it says the data is none? > > Traceback (most recent call last): > File "guess.py", line 34, in <module> > main(random.randint(1, 10)) > File "guess.py", line 27, in main > guess, tries = getguess(target, allowed) > TypeError: 'NoneType' object is not iterable > >
Please don't top-post. Further, if you insist on using a buggy app like googlegroups, at least remove all the stupid double-spacing. Do you know how to interpret this error message? The line that fails is guess, tries = getguess(target, allowed) So can you tell what the None data is? You're doing a tuple-unpack on the left side of the equals, so the right side needs to be a tuple, list, or equivalent. In specific, an iterable. Now you reread the error, and realize that the getguess() function is returning None. If I were a novice, I'd start by splitting up the line with the error: temp = getguess(target, allowed) guess, tries = temp Then when the error complains about the second line, I'd add a print statement: temp = getguess(target, allowed) print(repr(temp)) guess, tries = temp Lacking the source code, I'm going to guess that some path through your code is missing a return expression. For example, you might have def getguess(a, b): if a < b: return a, a*b So it'll return a tuple of two items in the if body, but without an else clause, it simply falls off the end, and returns None. (All functions return something, so if you don't provide a value, None is used) -- DaveA -- https://mail.python.org/mailman/listinfo/python-list