def read_and_write(source, target): """Takes source file and target file, reads data from source file and is processed by iscommand function and written to target file.""" with open(source) as src: with open(target, "a") as tar: for line in src: contents = line.split() iscommand(contents, tar)
explaination: - read_and_write: takes source and target as arguments and returns nothing. - The function reads data from source file and is processed by iscommand function and written to target file. - Contents stores the data from source file after splitting it into a list. - The data is then passed onto the iscommand function where it is processed and written to target file.