WorksheetsData Analytics using Python - Quiz 1
Total questions: 10
Worksheet time: 5mins
What will be the output of the following code:
A1 = np.array(['Juan','Matt','Tom'])
print (A1[0])
print (A1[-2])
print (A1[-0])
Juan Matt Juan
Juan Tom Tom
Error
Tom Matt Juan
What is the output of the following code:
students = np.array([['Alice','Beth','Cathy','Dorothy'] , [65,78,90,81],[71,82,79,92]])
students[...,1]
array(['Beth', '78', '82'], dtype='<U21')
['Alice','Beth','Cathy','Dorothy']
[65,78,90,81], [71,82,79,92]
error
What will be the output of the code:
heights = [165,170,168,183,172,169]
weights = [61,76,56,81,62,60]
student_bio = np.array([heights,weights])
student_bio.shape
(6, 2)
(2, 6)
array(2, 6)
np.array(6, 2)
What is the output of the code:
a = np.array([7, 8, 9, 10, 11, 12])
j = np.array([1, 2, 3, 4, 5, 6])
np.copyto(j,a)
print (j)
B: [ 1 2 3 4 5 6 ]
error
[ 7 8 9 10 11 12 ]
What will be the output of the code:
arr = np.array([[20,25,30,35], [40,50,60,70],[45,48,51,54]])
arr.flatten()
45,48,51,54,40,50,60,70,20,25,30,35
20,25,30,35,40,50,60,70,45,48,51,54
20,25,30,35,45,48,51,54,40,50,60,70
20,40,45,25,50,48,30,60,51,35,70,54
print(arr[-1,-2])
print(arr[2,3])
print(arr[1,2])
print(arr[0,0])
