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.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
read_cookie that:preferences.txt for reading data. You can assume this file exists.theme = from the data.change_theme that:write_cookie subprogram to write the new theme to the file.write_cookie that:preferences.txt for writing data.read_cookie function is called to return the current theme.change_theme subprogram is called.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
Automated feedback for this assignment is still under construction. Submitted programs are checked for syntax errors and their source code is checked for potential errors, bugs, stylistic issues, and suspicious constructs. However, no checks are performed yet to see if the program correctly implements the behaviour specified in the assignment.