Question: I'm new to using Python, and still very much in the learning process. I'm trying to work with reading data in text files, and printing

I'm new to using Python, and still very much in the learning process. I'm trying to work with reading data in text files, and printing out whatever specified results I choose. But, I'm not really understanding the coding involved and how to go about writing/structuring it, and could use some help.

I created a simple text file about cars, that I called cars.txt. In it, I had the information on 5 different models of Fords (Focus, Edge, Fusion, Mustang). So I have the make, models, and a brief description of each.

Brief Example of Text File:

Ford: Focus

Sporty, compact hatchback or sedan. Available in fwd, or awd transmissions, depending on trim....

___________________________________

Ford: Mustang

Performance sports/muscle car. Available in rwd transmission...

___________________________________

What I'd like to do is create a program that first prompts the user (myself or whoever else) to choose the model, ("what model are you looking to buy?") and can then read the text file, pulling the specific info for that model, listing the make, and the description underneath.

If possible, it would also be helpful to have a separate keyword search function, with a prompt asking, "what type of transmission are you looking for?" so, when 'awd,' 'rwd,' or 'fwd' is entered, it can list the number of times they appear in the description for each model.

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!