Skip to content

Repository files navigation

ASSIGNMENT4

FILES, EXCEPTIONS AND ERRORS

🔹Task 1: Read a File and Handle Errors

File: task1_file_handling.py

Description:

This program performs the following:

  1. Opens and reads a text file named sample.txt.
  2. Prints its content line by line.
  3. Handles the case where the file does not exist and displays a user-friendly error message.

🔹Task 2: Write and Append Data to a File

File: task2_write_append.py

Description:

This program:

  1. Takes user input and writes it to a file named output.txt.
  2. Appends additional predefined or user-provided data to the same file.
  3. Reads and displays the final content of the file.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages