Test Index
CBSE Class 12 Computer Science 2024 Paper Set 4
© examsnet.com
Question : 28 of 35
Marks:
+1,
-0
(A) Write a user defined function in Python named
showInLines() which reads contents of a text file named STORY.TXT and displays every sentence in a separate line.Assume that a sentence ends with a full stop (.), a question mark (?), or an exclamation mark (!).For example, if the content of file STORY.TXT is as follows :Our parents told us that we must eat vegetables to be healthy. And it turns out, our parents were right! So, what else did our parents tell?Then the function should display the file's content as follows :
Our parents told us that we must eat vegetables to be healthy.And it turns out, our parents were right!So, what else did our parents tell?OR(B) Write a function,
c_words() in Python that separately counts and displays the number of uppercase and lowercase alphabets in a text file, Words.txt.
Go to Question: