In: Computer Science
In this homework, you are provided a user pool (hw2_users_4m.txt) and a list of target users (hw2_targets.txt). Find if each target user is in the user pool. In python
1. Use set to store user pool.
with open('hw2_users_4m.txt', 'r') as i:
    user_ids_set = {line.strip() for line in i}
start_time = time.time()
results_set = []
##################################
## write your code for using set
##################################
end_time = time.time()
run_time = end_time - start_time
print(round(run_time, 2))
with open('output_set.txt', 'w') as o:
    for result in results_set:
        o.write(result[0] + ',' + result[1])
Below is a screen shot of the python program to check indentation. Comments are given on every line explaining the code.Below is the output of the program: Contents of hw2_users_4m.txt:
Contents of hw2_targets.txt:
Contents of output_set.txt:
Console output:
Below is the code to copy: #CODE STARTS HERE----------------
import time
with open('hw2_users_4m.txt', 'r') as i:
    user_ids_set = {line.strip() for line in i}
start_time = time.time()
results_set = []
with open("hw2_targets.txt") as j: #open targets file
    for target in j.readlines(): #Read line by line
        if target.strip() in user_ids_set: #Check if target is in users set
            results_set.append((target.strip(),"persent")) #update result list with "present"
        else: #If not present
            results_set.append((target.strip(),"not present")) #update result list with "not present"
end_time = time.time()
run_time = end_time - start_time
print(round(run_time, 2))
with open('output_set.txt', 'w') as o:
    for result in results_set:
        o.write(result[0] + ',' + result[1]+'\n')
#CODE ENDS HERE-----------------