EXERCISE TOPIC▼
- Access exercises (91)
- C# exercises (79)
- Excel exercises (278)
- Power Apps exercises (13)
- Power Automate exercises (18)
- Power BI exercises (139)
- Power Platform exercises (157)
- Python exercises (28)
- Report Builder exercises (141)
- SQL exercises (198)
- SSAS exercises (51)
- SSIS exercises (46)
- SSRS exercises (99)
- VBA exercises (85)
- Visual Basic exercises (46)
PYTHON EXERCISES▼
PYTHON EXERCISES▼
Python | Overview of NUMPY exercise | Create, slice and sum array of Tokyo Olympics medals table
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.
Software ==> | Python (28 exercises) |
Version ==> | Latest version |
Topic ==> | Overview of NUMPY (1 exercise) |
Level ==> | Relatively easy |
Subject ==> | Python training |
You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Total medals won by the top 5 countries at the Tokyo 2021 Olympics are shown below:

Go, United Kingdom!
Import the numpy module, and create a NumPy array to hold this information (including the country number). Here's what this should look like if you print it out:

The array should show the countries in rows and the country number and 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 another array to hold all of the rows of the first one, and all of the columns bar the first one:

The reduced array, excluding the country numbers.
Sum the array along the second axis to return the total number of medals won by each country:

China won more gold medals than the UK and the ROC, but less overall medals.
Close your program down!