Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

multiple choice the type code for an int array is b. what line of code …

Question

multiple choice
the type code for an int array is b. what line of code creates an array of int data values?
○ intarray = array(b,2, 5, 10)
○ intarray.array(b,2, 5, 10)
○ intarray = array(b,2, 5, 10)
○ intarray.array(b,2, 5, 10)

Explanation:

Brief Explanations

In Python's array module, to create an array of integer data values with type - code 'b', we use the array function and pass the type - code as the first argument and a sequence (list in this case) of values as the second argument. The correct syntax for creating an array object and assigning it to a variable is intArray = array('b', [2, 5, 10]).

Answer:

C. intArray = array('b',[2, 5, 10])