Suppose, you want to open some file for both reading and writing. You don't want to lose the contents of your file and you also don't want to get an error if by some chance the file doesn't exist. Which mode should you choose?
Tip: Remember that mode 'w' overwrites the contents of a file, while 'r' will result in an error if the file doesn't exist yet. Therefore, the 'a' option would be a better choice, since it creates a file for writing and doesn't delete the contents if it exists. However, you will have to combine 'a' with another mode if you also want to read the file.