Practice Question 22 In this question, we will write a function that reads a file and identifies the shortest (smallest) word based on the number of characters it contains. The…
BCA
-
-
Practice Question 21 In this question, we will learn how to write a function that scans a text file and calculates exactly how many blank lines it contains. This is…
-
Practice Question 20 In this question, we will learn how to write a function that takes the text from one file and writes it into another file in complete reverse…
-
Python Programs
Python: Copy Even-Length Words to a New File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 19 In this question, we will write a function that reads a source file and “extracts” only the words that have an even number of characters (like “code”,…
-
Python Programs
Python: Count Words in Each Line of a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 13 In this question, we will learn how to write a function that reads a file and displays the word count for every single line. This is a…
-
Practice Question 18 In this question, we will learn how to write a function that scans a text file and counts every word that begins with a vowel (A, E,…
-
Python Programs
Python: Display Words Containing Digits from a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 17 In this question, we will create a function that filters a text file to find and display words like “Python3”, “Win10”, or “Sector7G”—words that contain at least…
-
Python Programs
Python: Count Uppercase Letters in a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 16 In this question, we will learn how to write a function that reads a text file and counts the total number of Uppercase (Capital) letters. This is…
-
Python Programs
Python: Delete Lines Starting with a Specific Character (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 15 In this question, we will learn how to write a function that takes a character from the user and removes all lines from a file that begin…
-
Python Programs
Python: Transfer and Delete specific lines from a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 14 In this question, we will learn how to perform a “Cut and Paste” operation on specific file lines. We will move lines containing the word “error” to…