Hint
🧠 Not sure how to start?
Here’s how you can break this problem into simple steps:
Open the text file using Python’s
with open(...) as f:
pattern so it handles closing automatically.Read each line in the file. Use
.strip()
to remove newline characters.Split the line into words using
.split()
. That way, you can check the first word (the given name).Compare the first word to the name the user entered.
Use
.lower()
on both to make the comparison case-insensitive.
If it matches, store the entire line in a list.
After going through all lines, print out all the matches — or a message if none are found.
✅ Click Show Solution on the project page to see exactly how this looks in code.