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
493 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 ==> | Dictionaries (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 6 tallest buildings in the world (as of April 2023 anyway) are as follows:
At 310 metres tall, The Shard in London is the world's 96th tallest building (it's not even the tallest in Europe now, alas).
Create a program which stores this information in a dictionary using:
The building name as the key; and
A tuple or list containing the building's rank, city, country and height in metres as the value for each entry.
As a reminder of the syntax for working with dictionaries, this code would list out the names and colours of the Wise Owls' cats:
# create a dictionary of Wise Owl cats
cats = {
"Agatha": "Black and white",
"Annie": "Tortoiseshell",
"Marv": "Not sure",
"Neo": "Black and white",
"Sabrina": "Black",
"Salem": "Black"
}
# loop over dictionary's records
for cat_name, colour in cats.items():
print(cat_name + " is " + colour)
Now loop over the items in this dictionary to print out the contents, to get something like this:
Each dictionary item's value will contain a list or tuple, so you'll need to extract the building information from this each time round the loop.
Finally, something to ponder: was a dictionary the most suitable way to store this data or not?
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 2025. All Rights Reserved.