Write a program to count number of word from a text
file “[Link]” which is starting with uppercase
character, lowercase character, digit and special
character.
Example:
Happy new year 2020.
No of upper case=1
No of lower case=2
No of digit=1
No of special =0
F=open(“[Link]”,’r’)
s=[Link]()
L=[Link]()
u=d=l=s=0
for i in L:
if i[0].isupper():
u+=1
elif i[0].islower():
l+=1
elif i[0].isdigit():
d+=1
else:
s+=1
print(u)
print(l)
print(d)
print(s)
[Link]()
Write a program to count number of word
from a text file “[Link]” which is staring
with “the”, ”The”, ”my” and “My”.
Example:
They are playing. Myself Alex. The sky is
blue. Where is my pen?
The number of such word=4
F=open(“[Link]”,’r’)
s=[Link]()
L=[Link]()
c=0
for i in L:
if i[:3]=="the" or i[:3]=="The" or i[:2]=="my" or
i[:2]=="My":
c+=1
print(c)
[Link]()
Write a program to display those line from a text file
“[Link]” which contain at least 2 word which is
starting with vowel.
Example:
I am very excited to know about you.
He likes to do Mathematics.
I am not part of it.
Output:
I am very excited to know about you.
I am not part of it.
F=open(“[Link]”,’r’)
S=[Link]()
for i in S:
c=0
l=[Link]()
for w in l:
if w[0] in "AEIOUaeiou":
c+=1
if c>=2:
print(i)
[Link]()
Write a program to change the content of
the text file “[Link]” into toggle case from
Sentence case.
Example:
They Are Playing In The Ground.
Output:
tHEY aRE pLAYING iN tHE gROUND.
Write a program to display the Flight details of
those flight which is starting from “Mumbai”
and going to “Kolkata” from a binary file
“[Link]”.
Content of the binary file is
FL_NO FL_NAME FL_DEPT FL_ARI FL_PASNGR
F01 SPICE JET Mumbai Kolkata 200
F02 INDIGO Delhi Mumbai 300
F03 AIR INDIA Mumbai Kolkata 400