Suppose list1 = [1, 2, 3, 4, 5], what is list1 [-len (list1): -1]? A. 0 B. [1, 2
ID: 3833956 • Letter: S
Question
Suppose list1 = [1, 2, 3, 4, 5], what is list1 [-len (list1): -1]? A. 0 B. [1, 2, 3, 4, 5] C. [2, 3, 4, 5] D. [1, 2, 3, 4] If list1 = [1, 2, 3] and list2 = [1, 3, 2], what is the value of list1 > list2? A. True B. False Suppose list1 = [1, 2, 3, 4, 5], what does list1.reverse() do? A. Returns a new list with elements in reversed order B. Reverses the original list to make the elements in reverse order C. Both A and B D. None of the above What is the result of 'a#b#c#d'.split ('#')? A. ['a', 'b', 'c', 'd'] B. ['a b c d'] C. ['a', '#', 'b', '#', 'c', '#', 'd'] D. ['abcd']Explanation / Answer
Ans 3. list1.reverse() reverses the original list to make the elements in reverse order,and doesn't return any value.
So,option B is correct.
Ans 4.split function breaks the string into list of tokens,if delimitter is also used (here(#)) it removes the delimitter and displays the seperated list of tokens.
i.e [ 'a', 'b' , 'c' , 'd' ] is the answer. (option A).
Ans 2. list1>list2 compares whether each element in the list 1 is greater than list 2 or not so it will return FALSE(option B) in this case.
Ans 1. len(list1) will give length of the list i.e 5 (here)
now,we have list1[-5:-1], here '-' sign means count from right of the list,it will display all the elements of the list from 2(index 1) to last element of the list (5)(index 4).
So,option C is correct. [2,3,4,5]
here -5 represents 1st element of the list and -1 represents last element of the list.