Create a text file called Rhyme.txt with the following content:
The itsy bitsy spider climbed up the water spout. Down came the rain, and washed the spider out. Out came the sun, and dried up all the rain, and the itsy bitsy spider went up the spout again. Index the words in these lines (give the word and line numbers they appear in) and
write into another file called RhymeIndex.txt.
Display the contents of RhymeIndex.txt.
Answers
Answer:
it is not coming to the story of the story of the story of the story of the story of the story of the story of the story of the story.
Explanation:
fhfh. tnfjdjidk in the story of the story of the story of the story of the story.
Answer:
f=open("Rhyme.txt","w")
f.writelines('The itsy bitsy spider climbed up the water spout.\nDown came the rain, and washed the spider out.\nOut came the sun, and dried up all the rain,\nand the itsy bitsy spider went up the spout again.')
f.close()
f=open("Rhyme.txt","r")
fn=open("RhymeIndex.txt","w")
l=0
index=-1
lines=f.readlines()
for i in lines:
l+=1
ws=i.split(" ")
for j in ws:
if "\n" in j:
j=j[:-2]
index +=1
s=str(index)+"."+j+":LINE:"+str(l)+"\n"
fn.write(s)
f.close()
fn.close()
Explanation: