Global variable solution in Uncategorized category for Number Guess by
# Define as global the guessed values and the remaining divisors.
global values, numbers
# If it's the first call of the function. Update the two lists.
# Otherwise it will just update the guessed values.
if len(attempts) == 1:
numbers = [i for i in range(2,10) if not i == attempts]
values = [i for i in range(1,101) if i%attempts == attempts]
values = [i for i in values if i%attempts[-1] == attempts[-1]]
# Return the divisor and the guessed value.
value, number = values.pop(0), numbers.pop(0)
return (number, value)
Sept. 22, 2013