Use Of Arrays In Python Language

Watch video presentation and remember to subscribe to our channel;

Watch now!
In this tutorial we will discuss use arrays in python language. Although python does not have support for the arrays that are created inside but in this tutorial we will see how you can use lists as arrays giving out relevant examples.

Array – refers to a variable that can be used to store multiple values at a time. For instance, you may have lists for cars, books, fruits, languages among others.

Look at this example here;

fruits = ["mango", "pineapple", "orange"]

-In that case above you know they are only three fruits, but suppose the fruits are like 500 and you want to access a single value then we use array where we keep the values under a single variable fruits. You can refer to any value in an array as follows;

y = fruits[1]

In this section we will discuss how you can add or remove arrays values, modify arrays values and also finding the length of arrays.

  • Adding array values -you can easily add a value to an array as follows using append();
  • Removing array values -You can easily remove any value from an array as follows using pop() or just use remove();
case 1(use of pop()


case 2(use of remove()

  • Modify the value of an array – you can easily modify any value of an array. For instance, you modify the second value in the array as follows;
fruits[1] = "Avocado"
  • Finding length of an array -You can easily find the number of values in an array or what we call the length of an array as follows using len(). Let’s have an example here;
y =len(fruits)


Thanks for reading through our tutorial, as we continue learning python keep updated through our website and youtube channel till next time!