Question
Write a function countmy( )in Python to read the text file "DATA.TXT" and count the number of times "my" occurs in the file. For example if the file "DATA.TXT" contains: "This is my website. I have displayed my preferences in the CHOICE section." The countmy( ) function should display the output as: "my occurs 2 times".

Answer

Get the step-by-step solution for this question inside the Vidyadip app.

Get the answer in the app

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free