Question: These are questions from an old Python exam (5pts) Using Numpy, create a vector (array) of 500 points between 0 and 5e3. Write the code

These are questions from an old Python examThese are questions from an old Python exam (5pts) Using Numpy, create

(5pts) Using Numpy, create a vector (array) of 500 points between 0 and 5e3. Write the code using three different ways: x-np.r_[ ], Y = np.arange( ), and Z-nplinspace( ). (5pts) Using np.r_I], create a new matrix called threeRows that stacks each of the three identical vectors X, Y, Z in your answer above along the 0h dimension (i.e. the rows). Your matrix should be of dimension 3 x 500. (5pts) Suppose a list variable exists called nameList - ['Alex', Matt', Steve', Larry', 'Bob']. Using a loop and print), write text displaying the names to the console as: The X element name is: NAME where X is the index (element) position in the list, and NAME is the name at that index position (10pts) Write a Python function called compareSum that takes two vectors, A, B, and returns 1 if the sum of A is greater than the sum of B, or 0 if the sum of A is less than or equal to the sum of B

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!