Question: Please answer every single one I will rate. For Parts (a)-(g) below, show the single line of code needed by each part to do the
Please answer every single one I will rate.
For Parts (a)-(g) below, show the single line of code needed by each part to do the following: a) Create a 1-D NumPy array named x that contains the following values in this order: 1, 4, -2, 5, 8, -3 b) Create another 1-D NumPy array named y that contains the same values as x but in reverse order. Do NOT directly create it using np:array(). Hint: Look up the NumPy functions flipudl) and fliplr(). c) Create a 2-D NumPy array named z that has the values of x as its first column and y as its second column. d) Use the Python print() function to display the sum of the values of the first column of array z. Do NOT use the + (add) operator to do this. Hint: How can you extract a 1-D subarray from z? e) Create a 1-D NumPy array named m that holds the integer numbers from 1 to 99 in steps of 1. f) Use conditional indexing to extract from monly those elements which are divisible by four (4), i.e., 4, 8, ..., 96, and store them in a new array named n. g) Finally, create new 1-D NumPy array named p that contains the first four elements of m, all the elements of n, and the remaining elements of m from the fifth element onwards, in that order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
