Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have some trouble to understand your variables naming and usage, so I've simplified it a little:</p> <pre><code>def employee_write(file): employee_dict = {} employee_dict["First"] = file.readline().strip() employee_dict["Last"] = file.readline().strip() employee_dict["Experience"] = file.readline().strip() employee_dict["ID"] = file.readline().strip() employee_dict["Gender"] = file.readline().strip() return employee_dict def female_print(employee_list): for employee in employee_list: if employee["Gender"] == "F": print(employee["First"]) print(employee["Last"]) def main(): file = open("employees.txt", "r") n = int(file.readline()) employee_list = [] for i in range(n): employee_list.append(employee_write(file)) print(employee_list) female_print(employee_list) main() </code></pre> <p>which yields</p> <pre><code>[{'Gender': 'M', 'Last': 'Doe', 'ID': '272838', 'Experience': '33', 'First': 'John'}, {'Gender': 'F', 'Last': 'Johnson', 'ID': '3849383', 'Experience': '38', 'First': 'Mary'}, {'Gender': 'M', 'Last': 'Dog', 'ID': '839293', 'Experience': '6', 'First': 'Opie'}, {'Gender': 'F', 'Last': 'Dog', 'ID': '238392', 'Experience': '4', 'First': 'Missy'}, {'Gender': 'M', 'Last': 'Bla', 'ID': '834282', 'Experience': '28', 'First': 'John'}, {'Gender': 'F', 'Last': 'Spien', 'ID': '5789812', 'Experience': '2', 'First': 'Amelia'}, {'Gender': 'M', 'Last': 'CasenStien', 'ID': '567891', 'Experience': '2', 'First': 'Shane'}] Mary Johnson Missy Dog Amelia Spin </code></pre> <p>Is that what you want?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload