Reading file data
📖 Scenario: You have a text file that contains a list of fruits, one fruit per line. You want to read this file and work with the fruit names in your Python program.
🎯 Goal: Learn how to open a file, read its contents line by line, and print the list of fruits.
📋 What You'll Learn
Create a text file named
fruits.txt with the exact fruit names given.Open the file for reading using Python.
Read all lines from the file into a list.
Print the list of fruits exactly as read from the file.
💡 Why This Matters
🌍 Real World
Reading data from files is common when working with logs, configuration files, or any saved information.
💼 Career
Many programming jobs require reading and processing data from files, so this skill is essential.
Progress0 / 4 steps