Question: Tasks: Reading from a .txt file: Create a text file named sample.txt and write some sample text into it. Write a Python program to read
- Tasks:
- Reading from a .txt file:
- Create a text file named "sample.txt" and write some sample text into it.
- Write a Python program to read the contents of "sample.txt" and display them on the console.
- Writing to a .txt file:
- Create an empty text file named "output.txt".
- Write a Python program that takes user input (text) and appends it to "output.txt". Repeat this process five times.
- Reading from a .csv file:
- Create a CSV file named "data.csv" with the following headers: "Name", "Age", "Gender".
- Add at least five rows of data to the CSV file.
- Write a Python program to read "data.csv" and display its contents row by row.
- Writing to a .csv file:
- Write a Python program that prompts the user to enter information for a new person (name, age, gender).
- Append this information to the existing "data.csv" file.
- Reading from a .txt file:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
