Question: Problem 4: Write a program that loads data from a file called my_car.json. If the file doesn't exist or there is no data in it,

Problem 4:

Write a program that loads data from a file called my_car.json. If the file doesn't exist or there is no data in it, prompt the user to enter the model of the car they drive and store it in my_car.json using json.dump().

If the file exists and there's data in it, print out the contents of the file using json.load(). Then, ask the user if they'd like to change the model of the car they drive. If they would, ask the user for the new car model information and store it in my_car.json using json.dump().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!