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

Practice with NumPy arrays

Let's practice slicing numpy arrays and using NumPy's broadcasting concept. Remember, broadcasting refers to a numpy array's ability to vectorize operations, so they are performed on all elements of an object at once.

A two-dimensional numpy array has been loaded into your session (called nums) and printed into the console for your convenience. numpy has been imported into your session as np.

Bu egzersiz

Writing Efficient Python Code

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

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print second row of nums
print(nums[____,____])

# Print all elements of nums that are greater than six
print(____[____ > ____])

# Double every element of nums
nums_dbl = ____ * ____
print(nums_dbl)

# Replace the third column of nums
nums[____,____] = ____[____,____] + ____
print(nums)
Kodu Düzenle ve Çalıştır