Learn to Program with ZedLX

Free Online Programming Course for Beginners

Arrays [5/11]

The elements of an array can be of any type, including built-in types like num, int, and str. In this example, the array a has elements of type num, as indicated by the syntax num[].

Note that the indices of an array are always of type int, regardless of the type of the elements. Therefore, in order to access an element, the type of expression for the index must always be int.

Loading...