Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
numbers = np.array([
[40, 55, 66],
[30, 57, 23],
[72, 49, 20],
[20, 111, 203],
[999, 777, 202]
])
# Repalce the "None" values with your solutions
rows_count, columns_count = None, None
# Get the first element of each row and save it into array with shape (5,). The result should be: [ 40 30 72 20 999]
first_sequence = None
# Get the first element of each row and save it as 2-dimensional array (with shape (5, 1))
second_sequence = None
# Get the second and third elements from the forth and fifth rows
third_sequence = None
# Tests
nose.tools.assert_equal(5, rows_count)
nose.tools.assert_equal(3, columns_count)
nose.tools.assert_sequence_equal([40, 30, 72, 20, 999], first_sequence.tolist())
nose.tools.assert_sequence_equal([[40], [30], [72], [20], [999]], second_sequence.tolist())
nose.tools.assert_sequence_equal([[111, 203], [777, 202]], third_sequence.tolist())
@samuel-karanja

This comment has been minimized.

Copy link

@samuel-karanja samuel-karanja commented Jan 14, 2021

where does the name nose come from sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment