0% found this document useful (0 votes)
3 views

random

Uploaded by

hawk71443
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

random

Uploaded by

hawk71443
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

'''def fun():

with open("hell.txt","r") as f:

st=f.read().split()

for w in st:

print(w)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read().split()

for w in st:

if w[0] in "aeiouAeiou":

print(w)

fun()

def count_char():

f=open("hell.txt","r")

c=0

st=f.read()

for ch in st:

c=c+1

print("total characters:",c)

f.close()

count_char()

def count_char():
f=open("hell.txt","r")

c=0

st=f.read()

for ch in st:

if ch in "aeiou":

c=c+1

print("total characters:",c)

f.close()

count_char()

def count_word():

f=open("hell.txt","r")

c=0

st=f.read().split()

for w in st:

c=c+1

print("total words:",c)

f.close()

count_word()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0

for ch in st:

if ch.lower() in "bcdefg":

c=c+1
print(c)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0

for ch in st:

if ch.isupper():

c=c+1

print(c)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0

for ch in st:

if ch.islower():

c=c+1

print(c)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0
for ch in st:

if ch.isdigit():

c=c+1

print(c)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0

for ch in st:

if ch.isalnum()==False:

c=c+1

print(c)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read()

c=0

for ch in st:

if ch.isspace():

c=c+1

print(c)

fun()
def count_word():

with open("hell.txt","r") as f:

c=0

st=f.read().split()

for w in st:

c=c+1

print("total words :",c)

count_word()

def count_uniword():

with open("hell.txt","r") as f:

c=0

st=f.read().split()

for w in st:

if w.lower() in "the":

c=c+1

print("total words :",c)

count_uniword()

def count_uniword():

with open("hell.txt","r") as f:

chis=0

cher=0

st=f.read().split()

for w in st:

if w.lower() == "his":
chis=chis+1

elif w.lower() =="her":

cher=cher+1

print("total his :",chis)

print("total her:",cher)

count_uniword()

def fun():

with open("hell.txt","r") as f:

st=f.read().split()

for w in st:

if w[-1] in "aA":

print(w)

fun()

def fun():

with open("hell.txt","r") as f:

st=f.read().split()

for w in st:

if len(w) > 3:

print(w)

fun()

def fun():

f1=open("hell.txt","r")

f2=open("upper.txt","a")

st=f1.read()
for ch in st:

if ch.isupper():

f2.write(ch)

f1.close()

f2.close()

fun()

def fun():

g=open("hell.txt","r")

st=g.read()

for char in st:

print(char)

g.close

fun()

def fun():

f=open("hell.txt","w")

l=["i am bhoot","i am bhoot brother"]

f.writelines(l)

f.close()

fun()

def fun():

with open("hell.txt","r") as f:

k=f.readlines()

print(k)
fun()

import csv

def fun():

f=open("k.csv","w",newline="")

st=csv.writer(f)

for i in range(5):

n=int(input("enter house number"))

o=input("enter owner name")

p=int(input("enter no. of people"))

rec=[n,o,p]

st.writerow(rec)

f.close()

fun()

'''

import csv

def fun():

f=open("k.csv","r")

st=csv.reader(f)

for i in st:

if i[2]>'5':

print(i)

f.close()

fun()

You might also like