Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10. Write A Function To Take An Integer Numpy Array As The Input, Then (1) Create An Array That Has The Same Values As The

10. Write A Function To Take An Integer Numpy Array As The Input, Then (1) Create An Array That Has The Same Values As The Input Array, And If There Are Odd Numbers, Add 1 To Change Them To Even Numbers, (2) Stack The Input Array And The New Array Vertically, And (3) Change The Array To The Float Type (I.E. 'Float32). Sample Input: [ 15 7 12 14] Output: [[

image text in transcribed

 

 

10. Write a function to take an integer numpy array as the input, then (1) create an array that has the same values as the input array, and if there are odd numbers, add 1 to change them to even numbers, (2) stack the input array and the new array vertically, and (3) change the array to the float type (i.e. 'float32'). Sample input: [157 12 14] Output: [[1.5.7. 12. 14.] [2.6. 8. 12. 14.]] In [] import numpy as np example = np.array([1, 5, 7, 12, 14], dtype='int32') print(example, ' ') def array_func(a): # your answer here result = array_func(example) print(result.dtype) print(result)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting

Authors: Jonathan E. Duchac, James M. Reeve, Carl S. Warren

23rd Edition

978-0324662962

More Books

Students also viewed these Accounting questions