Test Index
CBSE Class 12 Computer Science 2023 Paper Set 4
© examsnet.com
Question : 27 of 35
Marks:
+1,
-0
(a) Write the definition of a Python function named
LongLines( ) which reads the contents of a text file named 'LINES.TXT' and displays those lines from the file which have at least 10 words in it. For example, if the content of 'LINES.TXT' is as follows :Once upon a time, there was a woodcutterHe lived in a little house in a beautiful, green wood.One day, he was merrily chopping some wood.He saw a little girl skipping through the woods, whistling happily.The girl was followed by a big gray wolf.Then the function should display output as :He lived in a little house in a beautiful, green wood.He saw a little girl skipping through the woods, whistling happily.OR(b) Write a function count_Dwords() in Python to count the words ending with a digit in a text file "Details.txt".Example:If the file content is as follows :On seat2 VIP1 will sit andOn seat1 VVIP2 will be sittingOutput will be:Number of words ending with a digit are 4
Go to Question: