0% found this document useful (0 votes)
2 views5 pages

Lab 2

The document is a report for Laboratory Work №2 on 'File Handling' conducted at Irkutsk National Research Technical University. It includes a series of Python programming tasks related to file operations, such as appending text, finding longest words, counting word frequency, and reading lines from a file. The report is prepared by a student and checked by a lecturer.

Uploaded by

koredemufid001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

Lab 2

The document is a report for Laboratory Work №2 on 'File Handling' conducted at Irkutsk National Research Technical University. It includes a series of Python programming tasks related to file operations, such as appending text, finding longest words, counting word frequency, and reading lines from a file. The report is prepared by a student and checked by a lecturer.

Uploaded by

koredemufid001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

The Ministry of Science and Higher Education of the Russian Federation

Federal State Budget Education Institution of Higher Education

IRKUTSK NATIONAL RESEARCH TECHNICAL UNIVERSITY

Institute of Information Technology and Data Science

Programming

Report for the Laboratory Work №2

«File Handling»

Done by a student of group ИИКб-21 / Artificial Intelligence

Surafel Teka Zewdie


Signature

Checked by Ph.D., Lecturer, Senior Researcher

Nguyen The Long


Signature

Irkutsk 2022

1
1. Write a Python program to append text to a file and display the text.

2. Write a Python program to find the longest words

3. Write a Python program to count the frequency of words in a file


2
4. Write a Python program to read a random line from a file

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

You might also like