A method is a function associated with an object. Call it with the object's name, a dot, the method name, and parentheses: object.method(). Methods can return values, just like functions. section 5.0
Reading a menu file
After opening drinks.txt, the file object f can use its read() method. Store the returned file content, then print it: f = open("drinks.txt") drinks = f.read() print(drinks) The result contains the file's contents, including coffee, chocolate, and decaf. section 5.0
f = open("drinks.txt")
drinks = f.read()
print(drinks)
Inspect the complete three-line example that opens a file, calls read(), stores its result, and prints it. section 5.0
YOUR TURN
- Write the short program yourself, read drinks.txt, and print the whole file. section 5.0



















