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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started