Enumerate with Python
I am here again to talk python. This week we learnt data structures and functions that are used in python. I will have to say, everything becomes simpler when you are doing it with python.
We all imagine of a life free of conundrums and clear as crystal. But it is unachievable, that's life. Python life, however, is enumerated one thereby making everything and anything to be found always at the correct place. Data Structures and functions play an important role in achieving that beautiful goal. Let's talk about them...
Data structures
Data structures store the data values in any programming language. The mapping of correct input type with correct output type is dependent on them. In python, there are various data structures like string and tuple [immutable], list and dictionary [mutable].
- There are various methods that these data structures can implement. One such method is 'enumerate()'. The literal meaning of enumerate is to order things one by one and that’s what it does in python, it orders values for you.
- There are minute differences in the syntax of these data structures. List is identified with [ ], tuple with ( ), dictionary with {Key:Value, Key:Value} and set with {Value,Value}. Also, I learnt that this language is pretty smart and understands user requirements.
Functions
A function, as our instructor quotes, is a set of instructions that is used to perform a single related operation. Python provides us with various in-built functions and allows the user to develop their functions too.
- With its wide range of inbuilt functions, every longer code shrinks to a few lines. These functions can be organized, reused, and modularized to perform big operations in adequate code lines.
- There is this lambda Function that works in single line code. Isn’t it exciting? Bigger and longer problems have smaller to smallest solutions in python. We can even assign a new value to a global keyword using the keyword ‘global’.
Before going, did you know that python abstracts most of its functionalities from users? Right from hiding the real executable file to the simple working of functions. Everything shown to the user is not only relevant but is the only thing that the user needs to know.
Then, with a gist of error and exception handling, this week’s classes ended. I am so excited to learn new things about python. Next week, we are going to learn about error and exception handling.
I will update you with what I learn in my third blog of “Let’s talk python”.