Task 1: Read a File and Handle Errors In this task, we create a Python program that reads and displays the contents of a text file named sample.txt. The program is designed to handle errors gracefully in case the file does not exist.
Task 2: Write and Append Data to a File In this task, we create a Python program that allows the user to input data and write it to a file named output.txt. The program also demonstrates how to append data to the same file and then reads the final content of the file to display it.