0% found this document useful (0 votes)
0 views1 page

Python ASSIGNMENT-4

The assignment requires students to construct a Python program that processes words and demonstrates file handling procedures. It includes tasks such as creating and reading a file, explaining file modes, and providing code examples for each mode. Additionally, students must write a program to count lines, words, and characters in a text file.

Uploaded by

mrayush2020
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)
0 views1 page

Python ASSIGNMENT-4

The assignment requires students to construct a Python program that processes words and demonstrates file handling procedures. It includes tasks such as creating and reading a file, explaining file modes, and providing code examples for each mode. Additionally, students must write a program to count lines, words, and characters in a text file.

Uploaded by

mrayush2020
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/ 1

ASSIGNMENT –4

Subject: Python Programming Subject code: BCC 302


Faculty Name: Mr.Ayush Singh Session: 2024-25
Section: E,F,G
Submission Date: 12/12/24

1. Construct a program which accepts a sequence of words separated by whitespace as file


input. Print the words composed of digits only.
2. Demonstrate the file handling procedure in detail. Write a python code to create a file
with ‘P.txt’ name and write your name and father’s name in this file and then read this
file to print it.
3. Explain the different file modes in Python:
"r": Read mode
"w": Write mode
"a": Append mode
"r+": Read and write mode
4. Provide a Python code example that demonstrates how to open a file in each of these
modes.
5. Write a Python program that reads a text file and counts the total number of lines, words,
and characters in the file.

You might also like