Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4 . 1 [ 4 pt ] In this question, we will practice slicing. Write a function called slicing _ practice that has three inputs
pt In this question, we will practice slicing. Write a function called slicingpractice that has three inputs called practicearray a numpy array that has at least five elements in it numa real number and numa real number and returns a dictionary with five keyvalue pairs:
firstfive: the first elements of practicearray as a numpy array
lastfive: the last elements of practicearray as a numpy array
lastfivebackwards: the last elements of practicearray in reverse order as a numpy array
middlefive: the middle elements of practicearray as a numpy array
numtonum: the segment of practicearray that starts with the first instance of num and ends with the first instances of numas a numpy array; notice that num and num are elements in practicearray not indices
If the shape of practicearray is such that there is no "middle five" but there is a "middle six", then take the first five numbers of the middle six. For example, the middle five of would be There is one more important instruction for this question: for your keyvalue pair with the key 'lastfive', please replace the first element of that numpy array with the number
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started