*Assignment*
*Find and Write answers and send to me*
1. How are lists different from strings when both are sequence?
2. What are nested lists?
3. Write all the methods names of list to perform various types of operations upon list.
4. What are list slices? What for can you use them ?
5. What do you understand by true copy of a list? How is it different from shallow copy?
6. What do you understand by mutability? What does "in place" memory updation mean?
Answers
Answer:
Hope it helps you
Explanation:
1.The lists and strings are different in following ways : a The lists are mutable sequences while strings are immutable. b Strings store single type of elements all characters while lists can store elements belonging to different types.
2.A nested list is simply a list that occurs as an element of another list (which may of course itself be an element of another list, etc.). Common reasons nested lists arise are: They're matrices (a list of rows, where each row is itself a list, or a list of columns where each column is itself a list).
3.extend() Add the elements of a list (or any iterable), to the end of the current list
index() Returns the index of the first element with the specified value
insert() Adds an element at the specified position
pop() Removes the element at the specified position
6.A mutant is someone who has been changed, irrevocably, so mutability is the ability to change. in place memory updation. An in-place algorithm is an algorithm that does not need an extra space and produces an output in the same memory that contains the data by transforming the input 'in-place'.
Sorry I don't know 4th and 5th