Hi friends,
In the previous post under Data Science & Machine Learning, we reviewed the various data structures supported by Python programming language. In this post, we'll see the conditional statements, various loops, user-defined methods and much more.
Note: All the commands discussed below are run in the Jupyter Notebook environment. See this post on Jupyter Notebook to know about it in detail.
Python Basics 2
So, let's begin with the conditional operators first.
Now, we see the conditional statements which use the conditional operators discussed above.
Now, we see the various loops supported by Python.
For loops:
While loops:
Now, we see user defined methods in Python.
We can avoid the for loop to achieve the same on a list using the map function supported by Python. What it basically does is maps each element of the list x to the function my_square.
We now discuss Lambda Expression supported by Python. Lambda expressions avoid the need to write the functions separately and then calling with map. Below is a sample example. Lambda expressions are used a lot while learning data science libraries.
That's it for this post friends. We also end the overview of Python programming language with this post. Now that we have reviewed the Python syntax using Jupyter Notebook, we are good to go ahead with Data Science libraries from the next post.
0 comments:
Post a Comment