Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am sharing a link to an excel file. https://mymaildrury-my.sharepoint.com/:x:/

ID: 3902899 • Letter: I

Question

I am sharing a link to an excel file. https://mymaildrury-my.sharepoint.com/:x:/g/personal/jtrentii_drury_edu/EftsWuJP2X5EqOouggNXd4QBqRD-G2uZAmm6WhDYDTyODg?e=wPIpxz
I need to write python code that will automatically fill in every row in column C with the make of the computer. Every row in column C should either say “Dell”, Lenovo”, “HP”, “Microsoft Surface”, “VMWare Virtual Machine”, or “other” based on what is in column A. Obviously if it isn’t one of the five major categories, then it falls into other. So for example, I would need my python code to automatically fill in C 93 and C 94 with HP. Rows c2 through c68 should all say “Dell” but if I were to change for example Column A22 to a Lenovo model, then C 22 would automatically change to say “Lenova”. And this should work for the entire C column even if I add more rows in column A. Thanks so much I am sharing a link to an excel file. https://mymaildrury-my.sharepoint.com/:x:/g/personal/jtrentii_drury_edu/EftsWuJP2X5EqOouggNXd4QBqRD-G2uZAmm6WhDYDTyODg?e=wPIpxz
I need to write python code that will automatically fill in every row in column C with the make of the computer. Every row in column C should either say “Dell”, Lenovo”, “HP”, “Microsoft Surface”, “VMWare Virtual Machine”, or “other” based on what is in column A. Obviously if it isn’t one of the five major categories, then it falls into other. So for example, I would need my python code to automatically fill in C 93 and C 94 with HP. Rows c2 through c68 should all say “Dell” but if I were to change for example Column A22 to a Lenovo model, then C 22 would automatically change to say “Lenova”. And this should work for the entire C column even if I add more rows in column A. Thanks so much
I need to write python code that will automatically fill in every row in column C with the make of the computer. Every row in column C should either say “Dell”, Lenovo”, “HP”, “Microsoft Surface”, “VMWare Virtual Machine”, or “other” based on what is in column A. Obviously if it isn’t one of the five major categories, then it falls into other. So for example, I would need my python code to automatically fill in C 93 and C 94 with HP. Rows c2 through c68 should all say “Dell” but if I were to change for example Column A22 to a Lenovo model, then C 22 would automatically change to say “Lenova”. And this should work for the entire C column even if I add more rows in column A. Thanks so much

Explanation / Answer

import openpyxl

wb = openpyxl.load_workbook(path)
sheet = wb.active
for i in range(sheet.max_row):
    cell1 = sheet.cell(row = i, column = 1)
    cell2 = sheet.cell(row = i, column = 3)
    cell2.value = cell1.value
wb.save(path)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote