Python Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 14)
14.
How do you initialize an array with five zeros using the array module?
arr = array(5, 0)
arr = array.zeros(5)
arr = array([0, 0, 0, 0, 0])
arr = array.array('i', [0, 0, 0, 0, 0])
Answer: Option
Explanation:
The correct way to initialize an array with five zeros using the array module is array.array('i', [0, 0, 0, 0, 0]).
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.