Write a Python program to find the largest number in a NumPy array
Write a Python program to find the largest number in a NumPy array
SOLUTION.
import numpy as np
# Taking dynamic input for array size
n = int(input("Enter the number of elements in the array: "))
# Taking dynamic input for array elements
arr = np.array([float(input(f"Enter element {i+1}: ")) for i in range(n)])
# Finding the largest number
largest = np.max(arr)
# Displaying the result
print("The largest number in the array is:", largest)