Previous Index Next

Review Questions

Short Answer

1. Create the following NumPy arrays

a) A 1-D array called z having 10 elements and all the elements are set to zero.


b) A 1-D array called vowels having the elements ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’.


c) A 2-D array called n having 2 rows and 5 columns and all the elements are set to 1 and dtype as int.


d) Use nested Python lists to create a 2-D array called myarray1 having 3 rows and 3 columns and store the following data:
2.7, -2, -19
0, 3.4, 99.9
10.6, 0, 13


e) A 2-D array called myarray2 using arange() having 3 rows and 5 columns with start value = 4, step size 4 and dtype as float.

Previous Index Next