Professional Documents
Culture Documents
5 6147449161064121301
5 6147449161064121301
count = 0
while True:
char = file.read(1)
if char.isspace():
count += 1
if not char:
break
print(count)
#2
file1 = open("C:\\Users\\HP\\Documents\\file.txt","r")
lines = file1.readlines()
c=0
for i in lines:
if i[0]=="s" or i[0]=="S":
c+=1
print("Total no of lines:",c)
#3
def vowelWords():
inf = open('C:\\Users\\HP\\Documents\\text1.txt','r')
out = open('C:\\Users\\HP\\Documents\\text2.txt','w')
w = line.split()
for v in w:
inf.close()
out.close()
vowelWords()
#4
def SUCCESS():
C=0
file2=open('C:\\Users\\HP\\Documents\\yo.txt')
x=file2.read()
w=x.split()
for i in range(0,len(w),1):
if w[i] in 'SUCCESSsuccessSuccess':
C+=1
print('total no of occurence:',C)
SUCCESS()
#5
def Hno():
file3 = open("C:\\Users\\HP\\Documents\\para.txt","r")
l = file3.readlines()
c=0
for i in l:
if i[0] in 'H':
c+=1
print("Total no of words:",c)
Hno()
#6
def remove_lowercase(x,y):
m=open(x)
n=open(y,"w")
k=m.readlines()
for i in k:
if i[0].isupper():
n.write(i)
n.write(" ")
a=open("C:\\Users\\HP\\Documents\\yo1",'r')
b=open("C:\\Users\\HP\\Documents\\f2",'w')
remove_lowercase(a,b)