Sample Solution
The following shows one way to solve this problem. It is not the only way this problem can be solved.
team_hr_sample.py
"""
Author: Brother Burton
Purpose: Practice working with files.
"""
with open("hr_system.txt") as f:
# The file has now been opened and stored in a variable "f"
# Read each line, one by one, into a variable: current_line
for line in f:
# Split the current line into its parts based on a space " " as the separator
parts = line.split(" ")
# Save the parts we need into variables
name = parts[0]
title = parts[2]
# Output the name and title as desired
print(f"Name: {name}, Title: {title}")
"""
Author: Brother Burton
Purpose: Practice working with files.
"""
with open("hr_system.txt") as f:
# The file has now been opened and stored in a variable "f"
# Read each line, one by one, into a variable: current_line
for line in f:
# Split the current line into its parts based on a space " " as the separator
parts = line.split(" ")
# Save the parts we need into variables
name = parts[0]
title = parts[2]
# Output the name and title as desired
print(f"Name: {name}, Title: {title}")
Download: team_hr_sample.py