Saving website preferences.
Websites save user preferences in small files called cookies. This allows the user to customise their experience on the website with preferences saved for when they return to the site in the future.
Write a program that reads a text file stored on the computer and outputs the contents. This will either be: theme = dark or theme = light. The program then asks the user if they wish to change the theme, and if they do writes this new data to the file, overwriting what was previously stored.
Use this boilerplate code as a starting point:
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
The current theme = dark
Would you like to change it? y/n: n
The current theme = dark
Would you like to change it? y/n: y
The structure of the preferences.txt file is:
theme = dark
or...
theme = light
Use these resources as a reference to help you meet the success criteria.
Run the program several times and open the `preferences.txt` file afterwards to check that your program has met the success criteria.
Check that you have: