Knowee
Questions
Features
Study Tools

1.Question 1What does the following function return: len(['A','B',1]) ?1 point3242.Question 2What does the following function return: len([sum([0,0,1])]) ?1 point1033.Question 3What is the value of list L after the following code segment is run :L=[1,3,2]sorted(L)1 pointL:[1,3,2]L:[1,2,3]L:[0,0,0]4.Question 4From the video what is the value of c after the following:c=add1(2)c=add1(10)1 point311145.Question 5what is the output of the following lines of code:def Print(A):    for a in A:     print(a+'1')Print(['a','b','c'])1 pointabca1b1c1a1

Question

1.Question 1What does the following function return: len(['A','B',1]) ?1 point3242.Question 2What does the following function return: len([sum([0,0,1])]) ?1 point1033.Question 3What is the value of list L after the following code segment is run :L=[1,3,2]sorted(L)1 pointL:[1,3,2]L:[1,2,3]L:[0,0,0]4.Question 4From the video what is the value of c after the following:c=add1(2)c=add1(10)1 point311145.Question 5what is the output of the following lines of code:def Print(A):    for a in A:     print(a+'1')Print(['a','b','c'])1 pointabca1b1c1a1

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

  1. The function len(['A','B',1]) returns 3. This is because the len() function in Python returns the number of items in an object. In this case, the object is a list with three items.

  2. The function len([sum([0,0,1])]) returns 1. The sum([0,0,1]) part of the function adds up the numbers in the list, which equals 1. This result is then put into another list, so the len() function returns 1 because there is only one item in this list.

  3. The value of list L after the code segment is run is [1,3,2]. The sorted() function in Python sorts the items in a list in ascending order, but it doesn't change the original list. It returns a new sorted list.

  4. The value of c after the following is not clear because the function add1() is not defined in the question. If add1() is a function that adds 1 to its argument, then c would be 11 after c=add1(10).

  5. The output of the following lines of code is: a1 b1 c1 The function Print(A) takes a list as an argument and for each item in the list, it prints the item followed by '1'.

This problem has been solved

Similar Questions

5.Question 5What is the result of the following operation?[1,2,3]+[1,1,1]1 pointTypeError [2,3,4][1, 2, 3, 1, 1, 1]6.Question 6What is the length of the list A = [1] after the following operation: A.append([2,3,4,5])1 point5 267.Question 7What is the result of the following: "HelloMike".split()1 point["HelloMike"]["Hello","Mike"]["H"]

3.Question 3Consider the following tuple A=(1,2,3,4,5), what is the result of the following: len(A)1 point4654.Question 4Consider the following list B=[1,2,[3,'a'],[4,'b']], what is the result of the following:B[3][1]1 point[4,"b"]"c""b"

What does the 'len()' function do in Python?1 pointReturns the length of a stringReturns the largest element in a listReturns the total number of elements in a listReturns the smallest element in a list

Which of the following statement will create list?L1=list( )L1=[1,2,3,4]

Question 17What segment of code would output the following?1122331 pointA=['1','2','3'] for a in A: print(2*a) A=['1','2','3'] for a in A: print(3*a) A=[1,2,3] for a in A: print(2*a)

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.