Lab 2
Lab 2
Programming
«File Handling»
Irkutsk 2022
1
1. Write a Python program to append text to a file and display the text.
5. Write a Python program that takes a text file as input and returns the number of words of
a given text file. Note: Some words can be separated by a comma with no space.
3
6. Write a Python program to read a file line by line store it into a variable.
Contain of text.txt:
What is Python language?
Python is a widely used high-level, general-purpose,
interpreted, dynamic programming language.Its design philosophy
4
emphasizes code readability, and its syntax allows programmers
to express concepts in fewer lines of code than possible in
languages such as C++ or Java.
Python supports multiple programming paradigms, including
object-oriented, imperative and functional programm