Question
PYTHON

VB Auto sells its own brand of spark plugs. To cross-reference to major brands, it keeps a table of equivalent part numbers (see image below). VB Auto wants to computerize the process of looking up part numbers in order to improve its customer service.

The user should be able to enter the part number and brand and look up the corresponding VB Auto part number.

Your program will automatically import all 4 txt files (BrandA.txt, BrandC.txt, BrandX.txt and BrandVB.txt) and place into Lists. Put those lists into a Master List. Search the Master List with the part number and brand to identify the VB Auto part number. Display the VB Auto part number. All in the python shell. The below image gives you the matrix.


VB Brand Auto A PR21 MR43RBL8 14K22 4 Brand C Brand X R43 RJ6 14K24 R43NİRN4 14K30 4 R46N RN8 14K32 PR24 R46T RBL1 7Y PR24 R46T RBL1 2-6 S46 J11 14K38 4 PR32 SR46 XEJ8 14K40 47L H12 14K44 4
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Thanks for posting the question, we are glad to help you. You need to create four text files and write the data in the table, once done, you need to update the file paths in the code and then you are all set to run the program

Here is the code and the output, refer the screenshot for the output and the code indenation

____________________________________________________________________________________________________

vb_list=[]
with open('F:\\BrandVB.txt','r') as vbfile:
    vb_list = [line.strip() for line in vbfile.readlines()]
brandA_list=[]
with open('F:\\BrandA.txt','r') as vbfile:
    brandA_list = [line.strip() for line in vbfile.readlines()]
brandX_list=[]
with open('F:\\BrandX.txt','r') as vbfile:
    brandX_list = [line.strip() for line in vbfile.readlines()]
brandC_list=[]
with open('F:\\BrandC.txt','r') as vbfile:
    brandC_list = [line.strip() for line in vbfile.readlines()]

zipped_list=list(zip(vb_list,brandA_list,brandX_list,brandC_list))

print('Type[1] for Brand A')
print('Type[2] for Brand C')
print('Type[3] for Brand X')
brand=int(input())
part_number=input('Enter part number: ')
found=False
for row in zipped_list:
    if row[brand]==part_number:
        print('VB Auto number:',row[0])
        found=True
        break
if not found:
    print('No entry found for brand and part number')

________________________________________________________________________________________________

image screenshot

thank you !!

Add a comment
Know the answer?
Add Answer to:
PYTHON VB Auto sells its own brand of spark plugs. To cross-reference to major brands, it...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT