Computer Science, asked by rubal0125, 9 hours ago

Assuming that a text file named FIRST.TXT contains some text written into it, write a function named vowelwords(), that reads the file FIRST.TXT and creates a new file named SECOND.TXT, to contain only those words from the file FIRST.TXT which start with a lowercase vowel (i.e., with 'a', 'e', 'i', 'o', 'u'). For example, if the file FIRST.TXT contains Carry umbrella and overcoat when it rains Then the file SECOND.TXT shall contain umbrella and overcoat it.

Answers

Answered by ykumar34
3

Answer:

def vowelwords():

    f1=open("text1.txt")

    f2=open("text2.txt",'w')

    for line in f1:

         line=line.split()

         for word in line:

              if word[0] in "aeiou":

                    f2.write(word+" ")

        f2.write("\n")

    f1.close()

    f2.close()

Similar questions