Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Task 1

The Program reads the file sample.txt present on the same directory. If the file doesn't exist, it raises the appropriate error, otherwise, it prints the line by numbers

Execution command:

python "Task 1.py"

Output:

Line 1: This is a sample text file.
Line 2: It contains multiple lines.

Task 2

The Program accepts a line to write in the file and anoter line to append it and then prints the file data.

Execution command:

python "Task 2.py"

Output:

Enter text to write to the file: Python TuteDude Assignment
Data successfully written to output.txt.
Enter additional text to append: Assignment no. 4
Data successfully appended.
Final content of the output.txt:
Python TuteDude Assignment
Assignment no. 4