It is working; the variable "number" is local to the generator expression and can't be used in the print statement. It works if you print something else instead (e.g. "Success!" in the article).
If you just want to print the numbers less than 10, it's easier to do:
print [number for number in numbers if number < 10]
or
print '\n'.join(str(number) for number in numbers if number < 10)
If you just want to print the numbers less than 10, it's easier to do:
or if you want the same formatting.