Followers

Sunday, July 4, 2021

List & Tuples - Data Types

 Hello Friends, Welcome to our Website Python11. Today we will talk about Complex Number which is a Subheading of Numbers. 

To understand this New topic you need to First read our last post which was on :

Lists & Tuples 

The Lists and tuples are Python's compound data types. We have taken them together in one section because they are basically the same types with one difference. Lists can be changed / Modified(i.e., mutable) but tuples cannot be changed or modified (i.e., immutable). Let us talk about these two Python types one by one. 



Lists 

     A list in Python represents a list of comma-separated values of any datatype between square brackets e.g., following are some lists : 
              [1, 2, 3, 4, 5]
              ['a', 'e', 'i', 'o', 'u']
              ['Neha', 102, 79.5]
like any other value, you can assign a list to a variable e.g., 
            >>> a = [1, 2, 3, 4, 5]
            >>> a
            [1, 2, 3, 4, 5]
           >>> print(a)
           [1, 2, 3, 4, 5]
To change first value in a list namely a (given above), you may write 
          >>>a[0] = 10              #change 1st item - consider statement 1 above 
          >>>a
          [10, 2, 30, 4, 5]

You Guessed it right ; the values internally are numbered from 0 (zero) onwards i.e., first item of the list is internally numbered as 0, second item of the list aas 1, 3rd item as 2 and so on. 
we are not going further in list discussion here. Lists shall be discussed in details in a later Articles. 



Tuples  


You can think of Tuples (pronounced as tu-pp-le, rhyming with couple) as those lists which cannot be changed i.e., are not modifiable. Tuples are represented as list of comma separated values of any date type within parenthesis e.g., following are some tuples : 
             
                 p = (1, 2, 3, 4, 5,)
                 q = (2, 4, 6, 8)
                 r =  ('a', 'e', 'i', 'o', 'u')
                 h = (7, 8, 9, 'A', 'B', 'C')


So with this, we end with this Topic, don't forget to follow me so that you can get the latest updates of my new posts that I upload weekly, I will try my best to upload daily OR you can Sign up for Newsletters at the top of the Blog and that will give you E-mail updates of my New Post.
Jai Hind!!!!

Vande Mataram!!! 

No comments:

Post a Comment

If you have any doubts, please do let me Know.