Dictionary reference error
#Write a function called students_present. students_present #should take as input one parameter, a dictionary. The keys #of the dictionary will be names, and the values will be one #of three strings: "Here", "Present", or an empty string "". # #Return a list of the keys for whom the corresponding value #is either "Here" or "Present". #Add your code here! result = [] def students_present(list): for key in list.keys(): value = list[key] if value != "": result.append(key) return result student_list = {"David" : "Here", "Marguerite" : "Here", "Jackie": "", "Joshua": "Present", "Erica": "Here", "Daniel": ""} print(students_present(student_list)) #If your function works correctly, this will originally #print (although the order of the keys may vary): #["David", "Marguerite", "Joshua", "Erica"] But my code is printing the result twice & I dont understand why.. Please help. ["David", "Marguerite", "Joshua", "Erica", "David", "Marguerite", "Joshua", "Erica"].