Python Program to Print Array Elements

Python Program to Print Array Elements. In the Python programming language, print the elements of an array. The number of elements in the array will be printed by this program.

In the Python programming language for beginners, the smallest number in the array will be determined using the len(arr) function.

arr = [100,300,500,700]; 
print("The elements are listed");
for i in range(0, len(arr)): 
print(arr[i])

 

Output:

The elements are listed

100 300 500 700

Array Element in Python to Execute the Output

Arrays in Python are a type of data structure similar to lists. 

They contain a variety of objects that can be of various data types. 

Furthermore, Python arrays can be iterated and have a number of built-in functions for dealing with them. 

An array is a set of objects, pictures, or numbers arranged in rows and columns. 

Arrays, among other things, are useful representations of multiplication concepts in mathematics.

len() Keyword to Print Element in Python

The length of an array is the number of elements that are present in it. 

You can accomplish this by using the len() function. 

The len() function returns an integer value corresponding to the number of elements in the array. 

This returns a value of three, which is the number of array elements.

For Loop in Python

Based on the function’s arguments, the range() function returns a sequence of integers. 

More information on the range() function can be found in Python’s documentation. 

The first value in the range is the start argument. 

Python assumes start = 0 if range() is called with only one argument. This is sample program to execute the Array Elements in Python.