Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

you have this code in your program. from array import * k = array(b,10,…

Question

you have this code in your program. from array import * k = array(b,10, 5, 2, 7) which line of code will add 12 to the array? k.append(12) k.search(12) k.index(12) k.add(12)

Explanation:

Brief Explanations

In Python's array module, the append method is used to add an element to the end of an array. The search method is not a standard method for arrays in Python's array module for adding elements; it is often used for finding elements in other contexts. The index method is used to find the index of a given element in the array, not for adding. And there is no add method for arrays in the array module in Python.

Answer:

A. K.append(12)