Q:

Error: 'list' object is not callable

 I'm trying to make a program that will pick up randomly a name from a file. The user would be asked if he wants to pick up another one again (by pressing 1). 
The names can't be picked up twice.
Once picked up, the names would be stocked in a list, written into a file.
When all the names are picked up, the program would be able to restart from the beginning.
I checked other similar problems, but I still don't get it...
from random import *

#import a list of name from a txt file
def getL1():
    l1 = open("Employees.txt", "r")
    list1 = []
    x = 0
    for line in l1:
        list1.append(line)
        x = x+1
    list1 = [el.replace('\n', '') for el in list1]

    #print("list" 1 :",list)

    return list1
#import an empty list (that will be filled by tested employees) during
#execution of the program
def getL2():
    l2 = open("tested.txt", "r")
    list2 = []

    for line in l2:
        list2.append(line)
    list2 = [el.replace('\n', '') for el in list2]

    #print("list 2 :",list2)
    l2.close()
    return list2

def listCompare():
    employees = getL1()#acquire first list from employee file
    tested = getL2()#acquire second list from tested file
    notTested = []# declare list to hole the results of the compare
    for val in employees:
        if val not in tested: #find employee values not present in tested
            #print(val) 
            notTested.append(val)#append value to the notTested list
    return notTested

def listCount():
    x=0
    employees = getL1()
    tested = getL2()
    for val in employees:
        if val not in tested:
            x = x+1

    return x
#add the names of tested employees the the second second file
def addTested(x):
    appendFile = open("tested.txt", "a")
    appenFile.write(x)
    appendFile.write('\n')
    appendFile.close()

def main():

    entry = 1
    while entry == 1:

        pickFrom = listCompare()
        if listCount() > 0:
            y = randint (0, (listCount ()-1))
            print ('\n' + "Random Employee to be tested is: ", pickFrom(y), "\n")
            addTested(pickFrom[y])
            try:
                entry = int(input("Would you like to test another employee? Enter 1:"))

            except:
                print("The entry must be a number")
                entry = 0
        else:
            print("\n/\ new cycle has begun")
            wipeFile = open("tested.txt", "w")

    print ("goodbye")
main()

 The last error that I have is : 
Traceback (most recent call last):
  File "prog.py", line 78, in <module>
    main()
  File "prog.py", line 65, in main
    print ('\n' + "Random Employee to be tested is: ", pickFrom(y), "\n")
TypeError: 'list' object is not callable

A:

As per the code print pickFrom is a list and when you are referencing it in the print it needs to be called using [ ]. Change it to pickFrom[y]

