Python Lab IYr Week-7
Python Lab IYr Week-7
1. Write a Python code to merge two given file contents into a third file.
2. Write a Python code to open a given file and construct a function to check for given words
present in it and display on found.
3. Write a Python code to Read text from a text file, find the word with most number of
occurrences.
4. Write a function that reads a file file1 and displays the number of words, number of vowels,
blank spaces, lower case letters and uppercase letters.
PROGRAM – 1:
Aim: Write a Python code to merge two given file contents into a third file.
Tools required:
1. Python distribution.
2. Python IDLE.
Procedure:
1. Open the Python IDLE open the new file editor, and type the following code.
Note: To successfully run the below program file1.txt and file2.txt must exist
in the same folder. Suppose the text files file1.txt and file2.txt contain the
following data.
file1.txt
file2.txt
OUTPUT:
file3.txt
PROGRAM – 2:
Aim: Write a Python code to open a given file and construct a function to check for given words
present in it and display on found.
Tools required:
PROGRAM – 4:
Aim: Write a function that reads a file file1 and displays the number of words, number of
vowels, blank spaces, lower case letters and uppercase letters.
Tools required:
1. Python distribution.
2. Python IDLE.
Procedure:
1. Open the Python IDLE open the new file editor, and type the following
code.
Note: To successfully run the below program file1.txt must exist in the same
folder. Suppose the text files file1.txt contain the following data.