Lists

--Originally published at Welcome to the Heaven

A list is a data style that have different kind of elements inside it. The principal characteristic is that the lists are mutable, in other words, you can change, add, remove and have access to the elements inside it, for this reason the lists are so important for a programer.

We can create a simple list with the name of the list and square brackets[] and write the elements inside it.

You want an example and I know it, so…screen-shot-2016-10-28-at-11-19-38-pmscreen-shot-2016-10-28-at-11-19-48-pmIn the first example we use a list that has predefined values and this list help us to print all the lower numbers inside it, if they have a lower value.screen-shot-2016-10-28-at-11-25-14-pm

And in the second we create a list with the values that the user is going to give us in the input. As you can see the input is only for integer values, so the user will write the number that he wants and the program is going to give us all the numbers that can divide the number and the result will be an integer, to make it possible we use mod in the program.

screen-shot-2016-10-28-at-11-34-48-pm