Python Test 5 - Lists Which of the following commands will create a list? list1 = list() list1 = list([1, 2, 3]) list1 = [] all of the mentioned What is the output when we execute list(“hello”)? [‘h’, ‘e’, ‘l’, ‘l’, ‘o’] [‘hello’] [‘olleh’] [‘llo’] Suppose listExample is [‘h’,’e’,’l’,’l’,’o’], what is len(listExample)? 5 4 Error None Suppose list1 is [2445,133,12454,123], what is max(list1)? 12454 123 133 2445 Suppose list1 is [3, 5, 25, 1, 3], what is min(list1)? 1 3 5 25 Suppose list1 is [1, 5, 9], what is sum(list1)? Error 15 9 1 To shuffle the list(say list1) what function do we use? list1.shuffle() shuffle(list1) random.shuffleList(list1) random.shuffle(list1) Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], Which of the following is correct syntax for slicing operation? print(list1[0]) print(list1[:2]) print(list1[:-2]) all of the mentioned Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1]? None Error 2 25 Suppose list1 is [2, 33, 222, 14, 25], What is list1[:-1]? Error 25 [2, 33, 222, 14] [25, 14, 222, 33, 2] Schreibe einen Kommentar Antworten abbrechenDu musst angemeldet sein, um einen Kommentar abzugeben.