Python Program to find sum of array

    
        # Get the length of the array from the user
        n = int(input("Enter the length of the array: "))

        # Initialize an empty array to store user inputs
        array = []

        # Get array elements from the user one by one
        for i in range(n):
            element = int(input(f"Enter element {i + 1}: "))
            array.append(element)

        # Calculate the sum of the array
        array_sum = sum(array)

        # Display the result
        print(f"The sum of the array is: {array_sum}")
    
Output
    
        Enter the length of the array: 5
        Enter element 1: 4
        Enter element 2: 12
        Enter element 3: 43
        Enter element 4: 23
        Enter element 5: 67
        The sum of the array is: 149