Lesson 12: Coding Exercise

Do the following:

  1. Create an object named my_friends that is my_friends.txt.
  2. Create that file with a with operator.
  3. Write to it a list of your friend’s names. Put each friend on a different line. Hint. the way in which you create a new line is with \n inside the string.
  4. Read that file that you created and print off each friend’s name.

If you get stuck, check out the code at Lesson 12: Cheat Sheet.