I declare a global variable pos, anyway the method printArr() doesn't see it. The interpreter says: undifined variable pos. Why? Thanks
import nltk
class Analyzer():
    """Implements sentiment analysis."""
    def __init__(self, positives, negatives):
        global pos
        global neg
        positives=[]
        negatives=[]
        i=0
        file = open("negative-words.txt","r")
        for line in file:
            h=file.readline()
            if h!="":
                if h[0]!=';':
                    negatives.append(h)
                    i=i+1
                    print(h)
        i=0
        file = open("positive-words.txt","r")
        for line in file:
            h=file.readline()
            if h!="":
                if h[0]!=';':
                    positives.append(h)
                    i=i+1
                    print(h)
        neg=negatives
        pos=positives
    def printArr (self, arr):
        print (pos[2])
    """Initialize Analyzer."""
I'll try to make it easier: The next code does not work properly, the program still prints out "0", not "5"
import os
import sys
global x
x=0
def func1():
    x=5
def func2():
    print (x)
func2()
 
    