Question: Define a function called trigram_printer() that takes a string containing a filename. The function should open the file with the given name, display its contents
Define a function called trigram_printer() that takes a string containing a filename. The function should open the file with the given name, display its contents on the screen, three characters at a time, and then close the file. This function is allowed to crash* if it's called with an invalid filename or a name of a file that doesn't exist. See the sample transcript below if you're still confused about what this function should do.
Never attribute to malice that which is adequately explained by stupidity.
Here is the transcript:
>>> trigram_printer("hanlon.txt") Nev er att rib ute to ma lic e t hat wh ich is ad equ ate ly exp lai ned by st upi dit y. >>> trigram_printer("murphy.txt")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
