an.
txt
welcomw2ckspe
cbse school 2023
Academic year 2023 is the best year
PROGRAM 16
f=open("[Link]","r")
for i in f:
for j in i:
if [Link]():
print(j)
OUTPUT
2
2
0
2
3
2
0
2
3
[Link]
My first book
was me and
My family. It
gave me
chance to be
known to the
world
PROGRAM 19
def countmemy():
f=open("[Link]","r")
n=[Link]()
print(n)
m=[Link]()
print(m)
n=0
for x in m:
if x=="me" or x=="My":
print(x)
n+=1
[Link]()
print("The count of Me and My is:",n)
countmemy()
OUTPUT
My first book
was me and
My [Link]
gave me
chance to be
known to the
world
['My', 'first', 'book', 'was', 'me', 'and', 'My', '[Link]', 'gave', 'me', 'chance', 'to',
'be', 'known', 'to', 'the', 'world']
My
me
My
me
The count of Me and My is: 4
[Link]
Line 1\n
\n
Line 3
Line 4
\n
Line 6
PROGRAM 20
f=open("[Link]","r")
lst=[Link]()
print(lst[0], end='')
print(lst[2], end='')
print(lst[5], end='')
print(lst[1], end='')
print(lst[4], end='')
print(lst[3])
OUTPUT
Line 1\n
Line 3
Line 6\n
\n
Line 4
[Link]
Life is like riding a bicycle. To keep your balance, you must keep moving.
When I'm not feeling my best I ask myself, "What are you gonna do about it?
Sometimes you win, sometimes you learn.
PROGRAM 21
f=open("[Link]","r")
a=[Link]()
print("The last line in the text file is :", a[-1])
OUTPUT
The last line in the text file is : Sometimes you win, sometimes you learn.
[Link]
@ Your limitation it's only your imagination.
Push yourself, because no one else is going to do it for you.
Sometimes later becomes never. ...
@ Great things never come from comfort zones.
@To live a creative life, we must lose our fear of being wrong.
@Dream it. ...
PROGRAM 22
def filter(s,t):
f1=open(s,"r")
f2=open(t,"w")
while True:
line=[Link]()
if len(line)==0:
break
if line[0]=='@':
[Link](line)
[Link]()
[Link]()
filter("[Link]","[Link]")
OUTPUT
@ Your limitation it's only your imagination.
@ Great things never come from comfort zones.
@To live a creative life, we must lose our fear of being wrong.
@Dream it. ...