Practice Question 7 In this question, we will learn how to write a function that counts how many words in a text file start with a special symbol (like @,…
CBSE Class 12
-
-
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…
-
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…
-
Python Programs
Python: Display Alternate Lines from a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 12 In this question, we will learn how to write a function that reads a file and displays only the alternate lines (1st, 3rd, 5th, etc.). This logic…
-
Python Programs
Python: Count Lines Ending with a Full Stop (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 11 In this question, we will learn how to write a function that counts how many lines in a text file end with a full stop (.). This…
-
Python Programs
Python: Display Words with Length Greater than 5 (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 10 In this question, we will learn how to write a function that reads a text file and extracts only the “Long Words”—specifically those that have more than…
-
Python Programs
Python: Remove Duplicate Words from a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 9 In this question, we will learn how to read a file, identify duplicate words, and overwrite the file so it only contains unique words. This is a great…
-
Python Programs
Python: Find the Longest Word in a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 8 In this question, we will learn how to write a function that scans a text file and identifies the longest word present in it. This logic is…
-
Practice Question 6 In this question, we will read a text file and find all the palindromic words present in it. A palindrome is a word that reads the same…