BaşlayınÜcretsiz Başlayın

Who's above average?

Boolean arrays can be a very powerful way to subset arrays. In this exercise, you will identify the prices that are greater than average from a list of prices.

numpy is imported as np and the array prices is available in your workspace.

Bu egzersiz

Introduction to Python for Finance

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Find elements in prices that are greater than price_mean and assign the boolean result to boolean_array.
  • Subset prices using boolean_array and assign the result to above_avg.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Find the mean
price_mean = np.mean(prices)

# Create boolean array
boolean_array = (____)
print(boolean_array)

# Select prices that are greater than average
above_avg = prices[____]
print(above_avg)
Kodu Düzenle ve Çalıştır