Practice 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
-
-
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…
-
Python Programs
Python: Count Frequency of Each Alphabet in a Text File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 5 In this post, we will learn how to write a function that reads a text file and counts how many times each alphabet (a to z) appears.…
-
Python Programs
Python: Replace Digits with ‘#’ and Save to New File (Solved)
by Mahesh Vermaby Mahesh VermaPractice Question 4 In this post, we will learn how to write a function that reads a file, replaces every digit with a ‘#’ symbol, and saves that modified version…