Question: 1 . Write a function in Python to count the words this and these present in a text file article.txt . [ Note that
Write a function in Python to count the words "this" and "these" present in a text file
"article.txtNote that the words "this" and "these" are complete words
Aditi has used a text editing software to type some text. After saving the article as
WORDS.TXT she realized that she has wrongly typed alphabet J in place of alphabet
I everywhere in the article. Write a function definition for JTOI in Python that
would display the corrected version of entire content of the file WORDS.TXT with
all the alphabets J to be displayed as an alphabet "I" on screen.
Note: Assuming that WORD.TXT does not contain any J alphabet otherwise.
Example:
If Aditi has stored the following content in the file WORDS.TXT:
WELL, THJS JS A WORD BY JTSELF. YOU COULD STRETCH THJS TO BE A
SENTENCE
The function JTOI should display the following content:
WELL, THIS IS A WORD BY ITSELF. YOU COULD STRETCH THIS TO BE A
SENTENCE
You can use read method which will read each character in the file in the loop if
you want to operate on each characters.
Write a function linescount that reads lines from a text file named 'zen.txt and
displays the lines that begin with any vowel. Also, write that content on a new text
file. Assume the file contains the following text and already exists on the computer's
disk:
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
The linescount function should display the output as:
Explicit is better than implicit.
Assume that a file named 'feedback.txt contains student feedback in the following
format:
Positive: Saksham improved grades, more confident now.
Negative: Arav needs better time management for coursework.
Negative: Samar should work on communication in group activities.
Negative: Soham could benefit from asking more questions in class.
Positive: Sakshi excels academically, a great team player.
Write a Python function named feedbackanalysis to calculate and display the
following information:
Total feedbacks stored in the file.
Count of positive feedbacks.
Count of negative feedbacks
You can use startswith method to check the first word of each line while matching.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
