Using [] Brackets in Python

We Will Work on this Example in Google Colab, As we have seen Accessing Python through Google Colab in my previous Posts. (Accessing Python Through Google Colab: – Sri Tech Studio)

I have assigned The Range of values from 1 to 5 in Variable x, printed the Variable x and Printed the List of Numbers in sequence in Variable z.

To address the particular Number or value from list :

suppose if i want the Value 3 from the below list, then look at cell 6, Z[2] will print the value 3

As we know that in python the indexing starts from 0.

To print the Length of the List :

len(z) will gives the length of the list , the length of the list in our below example is 4 .

Change the Particular Value in a list :

Here I want to change the 3 value to Hi from the list, Then the syntax will be as : z[2] = “Hi”