Pages

Sunday, January 28, 2018

Data Structures Python

Data structures are basically in the name. They structure data! Throughout the book we have covered different types of programs and statements now we shall finally go into lists!
With so many list functions i cant explain them all however here is a definition list of all the list functions.

With all these functions and their definitions lets see the example given by the book.


These functions are more simple as all the function is asking, is to find how many repeating words and then moves into rearranging the sequence itself. 
Here is my take on this function:


As shown the cars is a list containing some brand names. Afterwards I count how many BMW occurrences are in the list and came up with only one BMW. Then I ask how many Renaults are in the list ( There are none in the list) and the number it came up with was 0 as there are no Renaults associated with that list. When I ask for the index of Nissan I get 0, the reason behind this is that in computer languages 0 is the real 1 in counting indexes. And in the end i reverse the list!
My final question I want you guys to ponder is, Is this language easy to understand?





2 comments:

  1. This has helped me to learn how to use python, thanks.

    ReplyDelete
    Replies
    1. Thank you for this comment! I am glad you are understanding the programming language of Python!

      Delete