In "method1", you define 'x' as a variable, but not 'i'. Both will need to be defined.