Computer Science, asked by js6189764, 1 month ago

Write a method/function SHOW_TODO( ) in python to read contents from a text file ABC.TXT and display those lines which have occurance of the word "TO" or "DO".​

Answers

Answered by robinphili24
6

Answer:

The below should work.

Explanation:

def SHOW_TODO():

   with open("ABC.txt") as f: # Opens the file ABC.txt as f

       lines = f.readlines() #Assingning the variable lines the function to read the lines from the variable f

   for line in lines: # for loop to print output in a good way

       print(line)

print(SHOW_TODO()) # calls the function SHOW_TODO

Please mark me as the brainliest.

Similar questions