Test Index

CBSE Class 12 Computer Science 2024 Paper Compartment Get it on Google PlayDownload on the App Store

© examsnet.com
Question : 28 of 35
Marks: +1, -0
(a) Write a method/function COUNTWORDS() in Python to read contents from a text file DECODE.TXT, to count and return the occurrence of those words, which are having 5 or more characters.
OR
(b) Write a method/function COUNTLINES() in Python to read lines from a text file CONTENT.TXT, and display those lines, which have @ anywhere in the line.
For example :
If the content of the file is :
Had an amazing time at the concert last night with @MusicLoversCrew.
Excited to announce the launch of our new website!
G20 @ India
The method/function should display
Had an amazing time at the concert last night with @MusicLoversCrew
G20 @ India
Advertisements
Go to Question: