This question tests your understanding of Singed and Unsinged Integers In Python.
What would be the output of the following code snippet?
import array as arr
numbers_list = [5,6,8]
nums_1 = arr.array('f', [])
nums_2 = arr.array('I', numbers_list)
numbers_list.append(-9)
nums_3 = arr.array('i', numbers_list)
print(len(nums_3))
Answer: B
Explanation:
nums_1
is an empty array of floats.nums_2
is an array of unsigned integers containing 5, 6, and 8.numbers_list
is modified to include -9.nums_3
is an array of signed integers containing 5, 6, 8, and -9.- The length of
nums_3
is 4.
So, the final output of the code will be:
4