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
523 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 ==> | Overview of NUMPY (2 exercises) |
Level ==> | Relatively easy |
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.
Total medals won by the top 5 countries at the Tokyo 2021 Olympics are shown below:
Go Great Britain!
Import the numpy module, and create a NumPy array to hold this information (including the country number) using the np.array command:
# create a table to hold the medals table
medal_table = np.array(
[
[1,39,41,33],
[2,38,32,18],
[3,27,14,17],
[4,22,21,22],
[5,20,28,23]
]
)
Here's what this should look like if you print it out:
The array should show the gold, silver and bronze medal count in columns (there's no need to store the total medal count - we can calculate that).
Use slicing to create (and then print) another array holding all of the rows from the first one, but excluding the first column giving the country number:
The same information but omitting the country number.
Sum the array along the second axis to return the total number of medals won by each country:
Japan won more gold medals than the UK and the ROC, but less overall medals.
Close your program down!
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.