Question: Write a function: def split (self, i) that changes the array list (the one represented by self) by removing from it all elements from

Write a function: def split (self, i) that changes the array list

Write a function: def split (self, i) that changes the array list (the one represented by self) by removing from it all elements from position i on, and returns a new array list containing exactly those elements (in the same order). You can assume that i is between 0 and the lenghth of the list. For example, if 1s is the list [4,5,6,7,8] then ls.split (3) should change is to [4,5,6] and return the list [7,8]. On the other hand, 1s.split (5) should leave 1s unchanged and return the empty list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

def splitself i create a new list which stores the split array splitlist ... View full answer

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 Programming Questions!