Which one is correct?

Course Name: Python Practice Exercises, Section No: 11, Unit No: 14, Unit type: Exercise

array_max=numpy_dim_array1.max()

output is 999

but solution code shows np.max(numpy_dim_array1)

output is 999.

both are giving same outputs.

but we already assaigned varriable=np.array_name

 

Hi!



Yes, you are correct and in general you can use any approach. However this question explicitly mentions that we have to use the max() function from Numpy, rather than the .max() method for array objects, and hence the assigned solution is in line with the question wording.