- Opens and reads a text file named sample.txt.
- Prints its content line by line.
- Handles errors gracefully if the file does not exist.
Line 1 : This is a sample text file
Line 2 : It contains multiple lines
the file example.txt was not found
- Takes user input and writes it to a file named output.txt.
- Appends additiona l data to the same file.
- Reads and displays the final content of the file.
For example, if the user enters 25, the output should be: Enter text to write to the file: Hello,Python! Data successfully written to output.txt
Enter additonal text to append: learning file handling in python Data Successfully appended.