Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | Python (34 exercises) |
Topic ==> | CSV and Excel (2 exercises) |
Level ==> | Average difficulty |
Subject ==> | Python training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
The above folder contains a workbook listing plants, some of which are not in stock:
The plants not in stock are shown with the value No in column H (as helpfully highllighted above).
Create a program called Night-scented unstocked.py to:
Import the openpyxl module.
Open the workbook containing the list of plants.
Get a reference to the first sheet (called Sheet1).
Get a reference to cell A2.
Keep going down until your program hits a blank cell (ie one whose value is None), checking the value of the cell offset 0 rows down and 7 columns to the right of the current one for each (if this is No your macro should print out this plant's name).
Make sure you save your program before you try running it, as if you create an infinite loop you may end up having to close down Visual Studio Code!
A typical output from your macro when it's finished might be something like this:
The openpyxl module tries to mimic Excel, but sometimes throws up warnings like this when it can't.
Close down your program, musing to yourself on whether it might be easier to do this using Pandas dataframes (or even Excel VBA macros!).
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.