👾 The Alien Invasion!¶
Scenario:
You're a data analyst at the Earth Defence Organisation (EDO). You've just received a transmission containing data about an alien fleet heading towards Earth! The transmission contains vital data about each alien spaceship's dimensions, speed, and weapon power. Your job is to analyze this data to provide the EDO with the insights needed to prepare Earth's defenses.
Exercise:
The transmission is an matrix (an array) which contains data for each spaceship. Every line represents one spaceship, with values in the order of: length (in meters), width (in meters), height (in meters), speed (in km/s), and weapon power (on a scale of 1-10).
In [1]:
Copied!
import numpy as np
fleet_data = np.array([
[120, 40, 25, 2.5, 10],
[85, 60, 30, 5.0, 5],
[100, 50, 35, 4.5, 7],
[120, 40, 25, 2.5, 9],
[150, 50, 30, 3.0, 10],
], dtype=np.float32)
import numpy as np
fleet_data = np.array([
[120, 40, 25, 2.5, 10],
[85, 60, 30, 5.0, 5],
[100, 50, 35, 4.5, 7],
[120, 40, 25, 2.5, 9],
[150, 50, 30, 3.0, 10],
], dtype=np.float32)
Your tasks:
- Calculate and print the total number of spaceships.
In [2]:
Copied!
Total number of spaceships: 5
- Calculate and print the average spaceship size (volume).
In [3]:
Copied!
Average spaceship volume: 158600.0 cubic meters
- Identify and print the speed of the fastest spaceship.
In [4]:
Copied!
The fastest spaceship speed: 5.0 km/s
- Determine and print the number of spaceships with the maximum weapon power.
In [5]:
Copied!
Number of spaceships with maximum weapon power: 2
- Find and print the mean speed of spaceships with the maximum weapon power.
In [6]:
Copied!
Mean speed of spaceships with maximum weapon power: 2.75 km/s
Remember, the fate of Earth depends on your quick and accurate analysis. Good luck! ๐