Learn Python in 10 minutes


hello everyone, welcome to the semicolon in this tutorial we’re going to learn all the basics of python required for the series data analytics with Python but before we get started I would like to show you how we install the Anaconda package. follow these simple steps type anaconda on Google click on the first link now, this is the official URL and we’re looking for this i’ll be using python 2.7 version for windows and just to clarify python 3 and python 2.7 or python 2 aren’t advanced versions of each other rather Python 2 and 3 are just parallel versions so you can choose your options from here depending on your operating system and now once it is installed, click on start and type Jupyter notebook and click on it. a page like this open and, open a new Python notebook and we are done with our installation. most of the series will be using Jupyter notebook environment so now let’s get started with learning Python you can also type Idle in the start menu and use that environment to run the code or you can type it in the text editor whatever is comfortable for you. now let’s start learning python so this is what we are going to learn, we start with taking inputs displaying outputs for and while loops if else decision-making and some other data structures like list and dictionaries. let’s begin with taking the inputs, we type, we do it using the input function, input parenthesis takes the input and stores it in X we can also use raw underscore input and parenthesis, and store it and Y, so press shift + enter to execute and this what we type through the keyboard is stored in X and Y respectively. the type function gives us the type of variables so now let’s use it to show the difference between input and raw input, and we also learn how to display a variable, so print type of X and print type of Y and press shift + enter to execute and what you can see here is type of X is string sorry, integer and type of Y is string and raw input takes your input as string whereas X assigns it to a default type based on the input, and this is what the difference is. let’s start about the decision-making or the if and else branches in Python. so if X is equal to 1 then we print X is equal to one, so if command has two parts the condition and the command. if the condition is true then the execution goes to the command and executes it, if it is false then the execution goes to the else part and executes the command which is in the else part. so, if our X is equal to 1 then it will print X is equal to 1 otherwise it will print X is not equal to 1. let’s press shift + enter to execute but before that you have to remember the indentation part. now this space is called indentation this is very important in Python and this is how the condition and the command are separated. so, if you press tab the compiler will know that this is a command and this is a condition. now let’s do the same thing for Y and press shift and enter for X it was equal to 1 because our variable was an integer and for why it is not equal to 1 because Y is a string and 1 is a number so string is not equal to number and that is why it is wrong, it is false and it executes the command under else. now I’d like you to read about else if which is pretty straightforward and very similar to else. let’s start learning about loops in python. We will learn about while loops and for loop in Python. let’s start with while loops. Now, while loop again has two parts j is equal to 10, is the initialization of variable 10 while j is greater than 5 the condition is j is greater than 5 and print j and j equal to j minus 1 are the commands which, will be executed if the condition is true. so what happens is j is equal to 10 which is greater than 5 and it is true and it prints 10 and decreases the value of j and this happens in a loop till j is greater than 5. so that is how for loops work while loops work and for loops so I would like to tell you about the range functions. now range of n gives us the values, a list of 0 to n minus 1 so this is what we’ll be using for for loops when we type for i in range 5 i takes the value of each element in the list so i iterates throughout the list and therefore we print each value when we print i. so this is how for loops work in Python. let’s learn about the function calls in Python. A function is something which you will call to perform a specific task which will be defined. so let’s see how we define a function and call a function. so we define a function like this we type def and type the name of the function which can be a string and parenthesis, parenthesis takes the value which will be the input to the function and here our function increments it and returns it so return value will be the result of your function which will be returning, so how we call it is like this. we we call the function by writing its name and passing a value and it will return us whatever it is supposed to return, and it is returning us a number plus 1. our number plus 1 and this is how functions work in Python. now let’s start learning about lists or other data structures in Python. let’s begin with lists, lists are just like arrays but they are collection of many other variables or constants as so, they store it in a sequence and that is why we have we call it list. now we can initialize a list by typing this, a is equal to 1 2 3 in enclosed in square brackets. we can append something at the end of the list by typing a dot append and the number with it we can even delete a value at a particular index so here we are deleting something at index 1 now let’s see what happens when we execute this. so we print it out to see what happens when we execute. so now we have one three and five so initially our list had one two three then we appended five and then we deleted the one in position one which is two. Now, index starts with zero you can also access the last element by typing minus one, minus two would give you the second last element. now let’s learn about dictionaries, dictionaries are like maps they keep a mapping from a string to a number. so when we type x is equal to parenthesis, flower parenthesis we create a dictionary, which has index and value and our index is a b and c and the values are 1 10 and 11 so when we type X of a we get one because we are accessing the value at index of one and we can do this similarly. if we can initialize or add new values by typing a new index, and initializing it the value. so this is about dictionary. now this is all what is required for us to start our course on data analytics with Python. I am very excited about this course and I hope to see you there. let’s start right away from the next tutorial by learning about some basic libraries hit the subscribe button if you want to be

176
00:09:14,180 –>00:09:20,230
updated and hit the like button if this video helped you thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *