Question: Write function quote() that takes as input the name of a file (as a string) and an index i (as an integer). The file will
Write function quote() that takes as input the name of a file (as a string) and an index i (as an integer). The file will contain quotes, one per line. The function should open the file, read the file, close the file, and return the i-th quote (i.e. the i-th line in the file), assuming that the quote numbering starts at 0. Test your solution on file Wilde_quote file by downloading the file before running.
Usage: >>> quote("Wilde_Quotes.txt", 6) 'It is better to be beautiful than to be good, but it is better to be good than to be ugly. ' >>> quote("Wilde_Quotes.txt", 0) The mystery of love is greater than the mystery of death. '
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
