Python: Zero to Hero | Aditya Shankarnarayan | Skillshare
Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
13 Lessons (1h 24m)
    • 1. Welcome

      0:54
    • 2. Introduction

      2:00
    • 3. Basics

      5:37
    • 4. Variables

      8:35
    • 5. Strings

      11:11
    • 6. Lists

      12:15
    • 7. Dictionary and Tuple

      9:26
    • 8. Functions and Comments

      10:42
    • 9. While and If/Else

      9:03
    • 10. Game

      5:17
    • 11. For loops

      5:33
    • 12. Class project

      2:45
    • 13. Wrap up!

      0:24
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

23

Students

--

Projects

About This Class

Learn Python the right way!

Easy lesson with questions for each concept at end of each lesson.

Lesson are based on University curriculum and is explained thoroughly.

Topics covered in this class will set you up in the right direction.

Meet Your Teacher

Teacher Profile Image

Aditya Shankarnarayan

That Indian Coder Guy

Teacher

Hello, I’m Aditya
Iam a Programmer who is passionate about helping students become better coders. 
I have been programming since I was in the 8th grade and have been teaching for over a year now. I primarily focus on Data Science and related topics. 
I hope you find value in my classes and learn a lot from it. 

 

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Welcome: Python is a really important language right now. Every major company uses Python in some shape or another. So knowing Python for any coder is really important. And for any programming language, knowing the base is crucial. Hey guys, this is, and I have been programming for about six years now. I have about 15 certifications, and of which 12 of them have biotin as a base programming language. So when I was learning Python, the problem that I faced was I could not find good courses that gave me extra questions to solve. So in this class, I will be providing you with extra questions at the end of each class, as well as the class project is filled with extra question that you can solve. These will help you to gain a good knowledge of Python. And I really hope you enjoy my class and check out my other classes as well. 2. Introduction: Hey everybody, this is your basic introduction to Python, which I'll fly too. So Python has two types, Python two and Python three. Python two has been discontinued. Various Python three is what we'll use and is being updated differently. A few facts about Python will just good to know. Crd was created by Guido van Rossum. So python is basically used in back-end software development, scripting and machine learning. So Scripting is basically making a program that will help you do many task tools that we'll use for this class add is Python 3.7, which is the latest, which will use. So we can use any IDE or editor, will use the basic Python editor that comes with Python. We can use spider, spy char, or Sublime Text. It depends on your preference, will use the ID that comes with Python. So when you open idle, it will look like this. So the color might be different. You can change the color by going under configuration, which is under the options option. So the first thing we'll do is write a print statement. So the print statement is a function that will guide anything which is inside the brackets. So we'll write hello world. Hello world basically is a basic program, which is a string, which is basic alphabets and letters. So first we will have the inverted commas, then will write hello world. So to execute this, we'll press Shift plus n. So we'll get helloworld printed right there. This is the first lesson. 3. Basics: Welcome to a new class. In this class, we'll be diving deeper into Python and we'll be learning about a concept called variables. So now we'll be working with MIT accomplishment of cold. So we like to have a new file where we can save our progress. So we'll go under file and then prestin file. So before working with always save our file. So we'll give it a name and save it in a destination. So we save it as a.py extension, which is the extension of a Python file. So we have given a name so we can start coding now. In the last lesson, we learned about print statements. In this lesson we'll learn about variables. Say last lesson we learned something like this. So have we done extra code on the next window, so I don't forget anything. So these are a few print statements. So if we run it, we get this. So this is what we get. To get up. To get output. Here, we have to press F5. So if I wanted to change the name that is Yoda and 900, it will be really cumbersome to go, go ahead and change every single instance of that name or age. So we can do is we can give variables to that particular thing. So we can give something like this. So we have given a variable name which has the value Yoda and the age as a value 900. So variables, as a name suggests, has a value which can change. So we have given a name, which is a variable name. You can name the variable anything. But we always give the variable name something meaningful, cervical identified later on. So for this variable name, name, we have given the value, you're done. So you arise a string, alright, which means text. For the variable image, I have given the value of 900, which is the value of the integer 900. For the variable name, we have given the value true. So this is a new concept, true and false, which is called as booleans. True and false value. We'll learn more about them data. So the value can either be true or false. And always are true and false will have a capital T and capital F respectively. So how we can use this in our print statements, we have to do something like this. So this statement is doing is, you can see this name. We have defined this name of the variable name. We'll get the value of the meme, and then we'll concatenate with the rest of the string. This will basically add the value of the string and concatenate with that vector distinct that we have defined. We can only concatenate text or string values. So the variable limb name will be given and added to this thing. That is, we have given there is an alien. In the next line, we use 900 as available, which we cannot concatenate because it is 900. So the first thing is he is, and the second thing is age. Then we have defined the variable name age, which you have to print the earth. Then we have a comma, and then we have given the next thing that is after that. So now I'll save and press f phi to execute. And as you can see, it prints exactly the same text. But now if I have to change the value that we have written here, we can go ahead and just change that one value. As you can see, we got the change text with just changing one thing. So this is the basic information about variable. So for this lesson's question, I'd like you to go ahead and create print statements just like this. And we will discuss about the vm value in the next few lessons. I highly recommended, I highly recommend you do this programming question before adding on to the next lesson. 4. Variables: In the previous lesson, we learned about variables and how we can use these variables in print statements. Now will learn about different operations that we can perform on these variables. So I will declare two variables, a and b. And given the numeric values of 53. So there are two different numeric value, magnesium desert and which is 53. We can also give negative values such as minus five, minus 30, minus 15, et cetera. And the second is decimal values are floating values. Decimal values are basically 0.5.15.237.1 can also have negative values as. But for this lesson we'll just stick with individuals that is positive indigenous. So firstly, perform arithmetic operations. As the name suggests, it performs arithmetic operations. Mathematical operations is addition, subtraction, division, etc. So the syntax of this will be something like this. So I'll go through them one by one. The Aboriginal edition, which is active variables and it's a secondary subtraction. Multiplication. Next is division. Then we continue. This is called as the, so this operation is something divided the o values and given integer value as written, and will only return the integer value, which will not return any value after their decimal value. So if the value is 1.83 kilonewton, when is it wanted telephoning value? So this will return the power of the number and it will be raised by the b value. So if we have two to the power of two, it will return the power for. And this is the modulus operator which will perform that remainder. So I'll say when executed by pressing f phi c, You can see the values here. Eight phi minus 22 minus 215. And the division is 1.66666. And then next operation gave us the value one. And the next operation, which is the, which is raising the value, will give us value as 5H power three, which is 125. And this will give you the modulus operation, which is basically the remainder after dividing. And we get the values 1.666. And to give us to attenuate. And so now you go a little bit about the edits Multi Values. Now, you know about something, we tell about something and the tomato completions. So I recommend you to go and execute this code after this lesson. The other operation that you can perform as celebrations, these edification operations, operations will return a boolean value, which basically means that after that we execute this. It will give a true or false value. This can be used determine whether one is bigger than the number. And it can be used in many more applications where this additional operations can be used. These are called released and operations because this gives us a relation between the two operators, two variables, sorry. So we have eNB. So if the variable a is smaller than the variable b, just not the case, we return the value false. And this value, which is bigger than B, this will give us through, this will give us small vector equal to empty value is a, N, D is five. If a less than b, then it will give it the value true. This is f x vertically. This is the opposite of this. And this operator is print a is equal to, is equal to b, will return the value true if mode the variables have same value. This next syntax will give grew if both the variables are not same. So once you execute this, we get is false. Then we go through the next election. Is false. A is not smaller than B and E is not equal to b. And is one of the relations is greater than Mozart discarded as far as true. And n is not equal to B is false, and a is not equal to b is true. Is that a few relation operators? And the operators presented mathematical. Amy was, are these operators right here, which is max and min? Yes, x squared Daddy, it will choose the maximum value between the variables. So if you choose the maximum value as an inside this bracket inside. So it will choose the value between a and b, which has the higher value. And the next we'll find the minimum value. And the first one will give us five, and the second element will give us three. And v can also perform complex operations with this different operators that we have learned, such as like this. And this will follow the rule of biomass. And it will have dissidents of operator. So once we execute this, we get this value. And we got the max and min. And we got the value three. And we got the value five, because five is the maximum value, and so on and so forth. So this is the end of the lesson. And the question for this lesson will be, write a Python program of building a simple calculator. What I wanted to do is write a few variables and perform all arithmetic operations that have shown. And will decimal calculator. 5. Strings: Welcome. In this lesson, we'll be learning about the input function. The input function is really important as Helps, is, helps us to input particular to a variable. So we can do something like this. This is the syntax of a input function. Will first declare a variable, and then, then we'll add the input function. The text inside the brackets is the prompt. This prompt will be shown to the user. It will prompt the user to input a particular value. I have declared two variables, and amp, performing a simple addition operation inside. So if I get a value of one of a and B, then the expected answer will be two, right? Because one person is too right. But when I run this, I get the value one and do I get 12? The reason behind this is because input function, it takes in a string as default, which is just basically takes something like this. So it gets stored in the form of string. So now, so I have to call another function which will convert this thing into a numeric value. So I can perform the addition operation on it. So I use this. So this is, has a new function which has in the latter part of the code remains the same. But before it, we have iodine into function. So the function will take the input, which is user is giving, and then we'll convert them into integer, which is numeric value. And then it will show it to the variable. So if you execute this again, make it 12. We get three, which is the correct answer. So this can also be done for floating by either the decimal value. So for example, something like this. If I execute this, I give 1.21.2, then we get 2.3. The input function. This is very basic. It is very important. So the next important aspect is strings. So by working with things, we can do different things. So for example, this is a basic string nato than the first program. And now you can see everything slash n between the two words. So in Python programming languages, this thing after the slash is taken. Can we take an understanding for the process as it gets taken literally, at the slash n will be a new lens syntax. So when I print this, it will print hello and print to void in the other lane. And same for hello, then will give four spaces or tabs Base and then print world. If I execute this, can get hello, which is a normal helloworld. The second is hello. Then we have world then than we ever touched, but within hello and world. So this is a little more intuition about strings. If we want to input in order to coma, which we can't do because it is part of the syntax. But if you wanted to input a new model command, we can use slash. Then inputted as, as you can see, the quote, an inverted comma. Without breaking the syntax. The things we can use for the strings are. So this is an example of different functions that we can use. Which strings? So we have a variable and have string detonates. So when strings are stored with indexes, that is j being the first value, is the value of 0 index. So for example, let's take this Yoda stinger then exemption. So to understand thing, we have to conceptualize this as a fact that we can visualize a string that is Yoda. Each, each letter, alphabet is stored in a box. There will be four boxes and less number of these boxes. So number 123 in, but Python does not use this convention. By attenuators are convention that start with a value of 0123. That are four boxes. Murder counts out from 0. So by my stored in 0, G, o in the first and the second and the third. So let's get on with the examples. I have given this thing, which is the value Jedi knights. So if I print this thing, it will print villainize. Forgot upon the len function, it will print length of the string. The print how long the string is. If, if I written Yoda, print four. Because it has four letters. The next function is eta will convert every single letter in the string to an uppercase. Lowercase, you can moderate to uppercase and lowercase and we'll convert everything into lowercase. The next function is, is this can, this function will return a Boolean true and false. And basically checks if the string which I have given is uppercase. If it is in a, if it is in a per period return, true. There isn't also as function or as is lower. So we'll check if the function is in lowercase. To check this, the small function is the string in the order which will take this thing and convert everything into uppercase, then will convert and check. We can double-check intersting is an uppercase. The next function is index. What this is doing is I have pi sub j to this function. It will go and check if the, if the value something that matches inside the string that I have given it as a stairwell. So, so if I execute this, I can see in this string is the length of this piece is also counted, is also bounded as a character. Therefore, it is entered in this length. Is upward will convert, convert everything into uppercase. And we'll lower will convert everything into lowercase. So now I had executed Is it will give a Boolean value, which is not an uppercase, gave a value of false. And this one, I executed the small function, which converted everything into a purse thing and then checked if it was uppercase and gave us a value, value of true value. So the next one is about getting the index of the value that had passed J. As you can see, G is the first value. And as I told earlier, by thin uses a naming convention from 02, so on and so forth. So it gave us the value 0. So this is the input, as well as a few more details about strings. So for today's programming lesson, I'd like you to perform all of these programs and then check if, if this, if that is present multiple times in the string, what will be the index will give us? If something we have given is i. And the programming question is to create a string and perform all these operations, as well as lower and lower. And from the next lesson, I'll give you a little more challenging questions. Because you'll understand about Python and kind of work with different data types. 6. Lists: Welcome to the steam will do. And before I go ahead and we go, I'd like to mention one more thing, which is that a place function that can be used in Python. Which things? So I've mentioned this thing right there. And that it leaves function can be defined like this. This function will replace night. It's present in the string with space bikers. The thing you want to replace will be mentioned first. And something I don't want to replace it with will be mentioned after the comma. So if I execute this, you can get this string, just get ISPs fighters, and enter dynodes. So let's continue with the rest of the class. List is one of the most important data types in Python. So this ticker tape, as the name suggests, is a list of things. The things being data. It's an ordered list, which is, it means it is indexed. As I mentioned in the previous lessons, by ten years, an induction convention writing com 0. But the next numbers. So you can define that list by having square bracket. And at least looks something like this, which is the variable name, has three elements in them. You'd look and OB1 cannot be. All three of them are strings, which can also be done and can also be written with different data types like this. It can also have numerical values as well with water demand acceptable. So if I save and execute this before that I let me print. So when I picker data list, I shall get this list as a result. If I give you just mixed list, ten should give me second list as a result. So it says that the values are accepted in list as numeric as well as strings. So a few functions that will help enhance the functionality of lists are, is to get the index of a particular element in the list. So this is something that we use first things. So what this function is doing is going through the list and is finding the value yoga, which is present in entire destroying the parent idealist position. So we got 0. We can do the opposite as well. We can use the index of a particular list to get the value. So we're going to mix list and printing out the 0th index, which is yada, yada and 0. And that function that, which can be used to remove a particular element. We got this new list with most things. So now will be the moving Darth Vader from the list without actually going ahead and removing it manually. So I'll invoke the remove function. So this function will go ahead to the list and we'll remove the value from the list. And if I print the list, again, give me the list without W dot. So after executing, as you can see, we did not get w Darth Vader. This is the remove function. So if now after execution we want to clear the list, we can do this with just a single function, which is this, which is dot clear function. We can clear up that list using this function and then we print the list. And it will give us an empty list. And executing will give us an empty list. So the first is Afternoon Darth Vader, and the second is an empty list, which does not contain editing inside because we recently had a function. So these are the few functions or that present in the list. Now, we can use a sorting function that will sort a list. So if we have a list of numbers in it, so this list is not sorted in descending order. And if you want to make retain ascending order, we can use this function which is salt, which will sort the list in ascending order. And if you print out this list, we can get the value 12345, which is the sorted list. So this is all about laced and indifferent functions. So the next concept is nested list, which is a list inside a list, which can be written like this. As you can see, this nested list has a list and it has multiple three list inside of it. And each list has the first list L2 when dementia inside each list. This first list has three elements and the 0 list has two element. And the indexing of this list. Works in such a manner that this is 0 index is in the first-in, first-out index. And the third is the second index. This can also be called as nested lists or cordiality. So if I bring nest list, it will give us the exact list about. But if I want it to print the order, we can't just do it like this, but bending 0 will give me the first list, which is Uda and 900, like this. So to get the euro, which is present in the 0th index, in the 0th index of the list. At index. I should do something like this. You should see if I'm already get 900, which is the first element in the 0th element on the list. And this will give me 900. So this is the nested list concept. Now we'll be working with the tupples type in Python, which is also really important. It has a special function which is immutable. That is, once we have defined a tuple V counting gets values can be defined something like this. Sorted linked list gets indexed. I starts from 0. It can also be of any type. It does not need just to be of numbers or ofs. Thinks it can be mixed type as when. I can also add a floating value, would lose their license immutable. So the value of it cannot be changed once it is defined. So I have a list. I can actually delete something like this. So what I did was I have taken the list and change the first element of S2 and changed it to a three value. So if I, if I print out this value, I should get a one and cleaning Phila into 12. So how this works is it goes ahead and replaces the value of two with the value I've mentioned statistically. So now, if I go ahead and change the value of the heavy chain divided w1, v1. The list works. It can be assumed that we can do it for the double as well. But as I said before, it is immutable so it cannot do change the value. So if I execute this and should be done at a WHO does not support item assignment. And after it has been assigned a value before is immutable. And the thing is, I can create a list of tuples, a list which has different tuples in it. So if I print out list, which will give me a list of tuples, I should get something like this. And if I index if something like this and 0, we can get the first tuple. We can do something like this, which is the 0th index of the list, the first list. And if I do this, something became something like this. I'll write, this will be all for this lesson. In this lesson we learned about lists and doubles. And so for the programming assignment, I'd like you to go ahead and implement this Templeton list by yourself and see if we can execute them and apply a few normal functions to them. Also, don't forget to apply the different operators that we used in the previous lessons. And the next lesson we will learn about the dictionary. So please be terabit these programming concepts. 7. Dictionary and Tuple: In this lesson, we will be discussing about dictionaries. Beats Net is one of the most important concepts in Python. A dictionary can be understood as a normal dictionary. Lookup of word, meaning unfold, whose definition is require, say funny definition of Apple. We search for the word apple in the dictionary and we can do definition. So it's the same with dictionary. Has two values for key-value and normal value, maturity value of the key. So dictionary can be defined with curly brackets and is defined like this. As you can see, July edict is a dictionary variable. And these curly brackets, there's a curly brackets. I have three dictated element. So and each of them is buried by a coma. Dictionary element is named. The name is a key. We can identify the value that this key, this key name that I want to print, the name present in this dictionary. I can give this key value, and it will print out the value h is the key of 53, leaving the value as the key and value. So it doesn't matter if it's a numeric value or a boolean value. It can we of anytime. That can also be a number. But if it's a number, it won't have the inverted commas. The key and the value separated by this Golden's. This is how you define it steady. So I'll show you some functions that can be used for dictionaries. So this is, this is a dictionary. As you can see, name is Luke, k2, k3 injured. And that is a dictionary thing that we can do, 30-30. First Style. Toward the value at that key The name is giving me. Just look for the variable x. Here, print x. Give me the value. Look. Just because the value is sealed with the key name. As you can see, it would give me the value Luke. So that is how you can get the values with the help of keys or any other thing you can do is use the get method. It does the same thing. And carriage Z value using this getMethod does look. So now, say if I give it a key that does not exist in the dictionary. So if I gave it, if I give it a key of red does not exist in the next year, it is light. As you can see, the key value does not exist and that it's nitty gritty should not print anything. If I run it, I get a value of none. Third, dictionary is, is adding a new value to it. So what I'm doing is, I'm taking this, these tapes I mentioned here. I am using this key value of eight. And the key-value presented in this value has the value 53. And I have to change this value 900. So if I print, as you can see, the value of H has been changed. It has been changed to 5300. So this is how you change a particular value and it is given with a given key. So one example that I have to add one more key into the dictionary. I can go ahead and add one more key. Word won't be as efficient. So I can use this function. And this function is doing is, it is taking a key value is not present in the dictionary already. It will go and create new key, that is lightsabers color has a new key value and give it the value as blue. If I execute this, as you can see, we've got a new key value pair that is lifesaver colored and blue. So the next thing we can do is I'll pop function. If you're familiar with data structures, you know that Bob will move 30-70. It will remove the decently good value. So the pop function will remove a particular value from the dictionary. Say if I take this and didn't reach nearly as value, this value, something like this. As you can see, that the next time this dyadic steady should not give us the new color. As you can see, we have several color, which is blue. And in the next, we do not have the value. We get out of listening. The next thing we can do is we use the clear function to clear out the entire list. We can use declare function. We can use the dictionary as we'll see if I use this function. Clear out the entire dictionary, and make. Traditionally. As you can see, we have about an EM, pretty steady, steady, steady. Civil color. Here is popped out the silver color value. And I cleared the entire dictionary. Let's take an empty dictionary now. So I can add things to it. That is all for the externalities. The material dictionary can be seen in machine learning. Then when we need to access a particular variable, we can easily put the precise value of it by mentioning the key. So dictionary is highly use and one of the most important concepts, Silver Lake, you to go, go ahead and perform this programming question where you're defining each day and perform all these operations. And the announcement have to make is that I have added a text file with all the different question that I've mentioned. So you can check it out. So I've given a few extra questions in this OPM or doing whatever questions that you are doing. And I'll see you in the next lesson. 8. Functions and Comments: In this lesson, we'll be learning about functions and commenting. So we start with functions, as the name suggests, functions at a set of instructions that v at defining. And we need to be done repeatedly. So here's an example of a function. So function is defined as defined def. Then the function name, then the inputs that we're going to give to the function. So, so Rehfeld's syntax, and this is the function name. This function name can be anything but itself is an indium. We divide it by using underscore. This failable limiting technique is used extensively, even giving names to the variable. Name is the input given to the function. So now, so what this function is doing is it is printing the name which you are giving it. So this is a simple function, but think about if you have to print this name or the statement over and over, this tedious to statement over and over again with different names. But if a function like this and just give it a name, it will print the entire statement. Metadata is writing the statement. So if you are wondering phi, this piece here, this space is called less in condition. So we're in temptation is a v by ten defines this statement, part of this statement, this definition. So if you're familiar with other programming languages to C and C plus, plus, they use curly brackets to define. But by things in condition. So always be careful of the same translation. So the function should be writing, should go into admin like this. It can be done by then by pressing the tab button. So now get exiting the function. The function. I can call the function. We can call the function by giving the function name and giving the value of the function that I'm calling the function, giving it the name value. And then name, I'm passing it two needs to be a string, and I'm passing it devalues look. So when I execute this, as you can see here, it prints out the name is Luke. So now, if I wanted to print another nim. I can do this very easily just by calling the function again and giving it a different name. And just like that, I have two different print statements were two different values. So once we are performing extremely complex operation, we can define it in a function and we can use it repeatedly was by calling the function and giving it inputs. You can have multiple input that you can give to the function. So here is an example. You have the function name is print the name and age. And we're passing name and age as the input. So now I'm exerting their definition because anything that I had idea after time-space is considered part of the function. So after exiting this function, I'm calling it bring name. And age. I'm giving you two values. That is when name value that is a string, and when age is a numeric value. So I'll pass Luke as a string and printing with a comma and then a GVV 54 by four statement is printed. That is, I, name is Luke and the ages before that dysfunction with multiple inputs. So now I can also pass it visited different variables. If I have name is equal to Luke. And Luke, I'm just passing the variable name. Still prints the same thing. As you can see. It also does not require to be the same name as the function. It can be anything. This keep in mind. You are giving you the case. You can't give 54 before the name. First thing I do five to this function is the name and then I can visit. We have to be very off what is the order that fair use into paths d input values? As you can see, even do the data will be much different than what we given the functioning, print the same thing. Now we are going to check different return function, return function. Value from the function. Return function can be written something like this. With a new function. This cube root would give us the value of the number to the third, giving it. So if you require the number had and printing the number, we are returning the value we get after executing this equation. Basically this equation, this is calling the function right here, will execute d equation. This will be converted into the value which the equation will give us. The value cube root of eight is two. So this will become two multiplied by F1. And we will vary by two, will give us the value four. So current can be used like this and many other VS with complex equations as well. So now execute this. And as you can see, the value for if you want to the value to be an integer and return the value in integer function by using the INT function. And we look forward, which is integer. So now we're going to discuss about commenting. Commenting is really important because the Fed giving your code to someone else and it will help them to understand the code as well as good practice. If you are referring to a long time, it will be extremely easy for you to identify what the function means and what the variable is to, for example, to comment, you have to use the hashtag. Then it cannot anything. I'm going to write Jedi. So this portion will not be executed. In the final execution. You can only read this entire text editor. So I also covered this. As you can see, the comments are not printed or be interpreted. So now, if I want to commend our multiple lines, and as you can see, when I press Enter, it starts to code. So if I use multiple lines, have 2pi, pain modelled commas. And I write her comments 123. And when I close this, this will become one comment which spans over multiple length. So when I execute this, the comments are still not executed. And this is a good practice to coding the combinatorial code. So you can understand it as well as adults can also understand it easily as well. So this will be end of the lesson. And the program in question for today. That the writer function about printing names as well as eta function that you'll pass an element of a list. And then you'll print out the element of the list. I'll give a few HTy question in the documentation. 9. While and If/Else: Welcome to this new lesson. And before going onto the new lesson, I'd like to clarify one thing. The text file will be uploaded and will have many questions that you have to solve. And I hope you guys solve these questions as well as all the questions that I mentioned in the classes are the lesson that I have already conducted. So in today's lesson, we will be talking about loops. Loops is basically how we can perform different operations over and over. The condition is met. The basic values by loop. While loop, as the name suggests, will do a particular operation over and over till the condition is met. So first, I started declared a variable counter. And this is syntax for a while loop. It follows in condition as given in the previous videos. So anything in the tab space which fall under this while loop. So this loop will run till this condition is met. So rendition the relation cooperation, we do know that this means that not equal to. So this while loop will run till the counter is not equal to 0. And the counter variable is five. And counter variable is five. It takes this condition. It is not equal to 0 to n, n p value 510. Then this will reduce the value by one at ACH, a fancy way of acting counter is equal to minus one. So once I execute this given, give to print 54321, I've set the counter to five. And after that execution is done, equity, the value for n not equal to 0. It printed for, in printed 321. I did print every single value. And when it came to one, and it basically went to 0. And y loop are satisfied and the loop broke. So now we'll talk about if else. If else is extremely useful statement. And as the name suggests, it means if a condition is satisfied, we will do a particular task. And if the condition is not met, we look particular task. So you're simply if else statements. So if instead if you remember the first lecture, there was a Boolean statement that is true. So true and false are two Boolean values. And good value can be seen in this if-else statements. So if, if this guy is equal to true, if both the values are true, or distillation operation in this Jedi variable is equal to true. If the value of this variable is equal to two, then, then printing is a Jedi. If, if the value is false is not agenda. So if I run this, I should get. But now I'll go ahead and change it to false. So when I run this, I'll get this. He's and I can even write complex statement on new if-else like this. In this statement, I have two Boolean values that is true and true. And if you're wondering, what is this and, and, and, and is also relational. Relational operator means that if, if both the conditions are satisfied further after the and are met, then only the next line will be executed. This false to funds. Both has to be met so as to prevent the next length. So L has a normal percentage which is being printed. Now we have an, we have a nested if-else. So what are nested if-else if statement? Then I have an else statement. Also, we have to give one more condition to it because it's a complicated condition. We can use this leaf to give an else. If, to give one more condition, then we have our final l. So once we execute this, maybe it is usually because we get true and true that for the first treatment is a coated. So if I go ahead and change the value to false, then he assisted. The second condition was written. So now first week unit of force when you do false, no one would the conditional command. Then we'll get it or select one being printed. Now let's expand this. The first value goes and checks. The reality is false. So it won't bother checking if the secondary treatment is true. Because what we can have the and operator, because both operators need to withdrew to operate the print statement. Now it goes to the if statement. It takes him delta is equal to false, is equal to four. The next statement is check. Because force is not equal to two, because force is false. It discards that print statement. So the remaining thing is print even normal person status if else and else-if and nested if-else. And this end, an oil operator can be used in multiple ways. So then example of this is, are or can be used something like this. If I give two conditions to it, neither one is satisfied, it will print the statement is true. So if I execute this, you can see a low-key was printed just because one value must rotate the level US falls it printed out value for a particular Q. If I go ahead and changes could prove. And then this Q is not printed because neither of the option we satisfied. And if both of them are satisfied, still print that true value that is lucky. As you can see, Loki was printed and individuals. So that's it for today's lesson. And in the next lesson, we'll be making a first game. And before that, the big question for this lesson is mentioned in the is my fed into extra documentation. 10. Game: So in this lesson, you'll be making our 5K to game. So this game is extremely simple game. The logic behind this, this, you're going to guess out forward, has already been defined. Deliberate number of cases. So you can also do is after each case you can give a hint. So it's easier for them to guess. What I want you to go and implement this sort said first, after some time, I'll explain it to you. So I hope you do and understand how the discord by yourself. So this is the game. So the secret word is three. And this is a guess toward the user will input is stored right here, gets the string. So I have mentioned it to the commas as enamored of guesses. So I have used a while loop as well as an operator. So the guess word is not equal to the actual word itself already mentioned here. And and the number of guesses is not equal to 0. Then Oracle guesses will execute this line of code. So I've also given hints with each iteration. Iteration on the guesses. With iteration it will print x is female service guy. If the person get to drunks, she was in the last three movies. By the number of guesses is equal to two. And the last and final guessed it will, it will print the last remaining Jeddah. And after this execution into parser NOW this will print, you lose and the percentage to guess, it will print the. So this input statement will be executed every time, which will take the input from the user. And I fear wondering why this statement is part of this if statement. I mentioned in the previous video. This if statement uses the concept of in condition. So anything in candid inside this if statement, that is p is between if and the next statement is intended for D above it. So there is a reason why I guess is part of the if statement. And this will keep on reducing the number of guesses every, every iteration. Cl and grandes, game-like. So the first thing we need is a female servers character model. I know the answer. And give you the give me the next hint. I'll give the value Luke. And give me the last thing. I guess the last remaining Jedi still give a wrong answer, which is OB. And I lost the game because they've not get lengthy. Says. So now, if I play this game again, but now I will guess the word correctly the first time. And as you can see, and get de winning state when delta z. So this is that basic game. I hope you understood this chord. And a dishonourable pseudo-class assignment for this is, is to create a game called Mad Libs. If you're not familiar with this game, Mad Libs, you can go ahead and Google yet what mad ellipses and try and implement this in Python. 11. For loops: In this lesson, we'll be covering four loops. For loops can get really complicated. But if you're B, signal it and it will become very easy. Even the completed four loops will become easy to understand. Since this ALU has, has a variable numbers. So these numbers will have values in dealings 0 to ten, because Python uses the indexing starting from x2. So start chocolate number 0. It will print the number 0. Thank you. We'll increment. And the number one, and so on and so forth. And when it prints nine, it will increment will become the value of n and the condition will be satisfied and the for loop will break. So if you execute this, as you can see, we got the value from 0 to 910. So this is a basic for loop. I can also have a brink by using a range starting from five until the end agrarian deadline. So if I execute this, I have value starting from five. Hand had been curated from 56789. I started the value five and execute the value before the number that you mention it. So the for loops are really useful of printing each vector in a particular string. So the alphabet is available, which will take values of all the alphabets are laters present inside the strings. So if I print this, as you can see here, to print every single character inside the string. And as you can see, it also prints out the space. And each of the electors in Skywalker. I can also use this, print different elements in a list. So I have defined a list, right? Which I have mentioned in the previous videos, which is available in Judah list1, which is defined here. Print every single string that I've mentioned in this list. So I'm saying C2, this have got MD single, every single string present inside the list. And we can traverse a list. So if I have all of different index of element in the list, we can use this function in the for loop. So this length function will give me the length of this list. And the lengthening stays for for differentiating presented by the list. So what this will do is this will print every single index of the element in the list. And we'll print 0123. So if I run this, I get the value 0123. So we can also use if and else statement. And this and this for loop. And we can use in such a fashion. And what this will do is if the counter is 0, this is the first iteration. If it is not 0 and not first. Safer execute this. I get the first iteration, it will get first. Now. And the rest of it was not first. So this is for loop. And Congratulations, you have reached the end of this class. In the next few videos, we'll be about her class project. And do programming question for this is you have a list and you have to add, add every single element inside of that list. Using a for loop. You can also try it. Mehta, mathematical operations. 12. Class project: Welcome to your class projects. So this is your second last lesson of this class. So this, so this lesson has different questions presented them. This question, there are varying difficulties. So I hope you find these questions challenging enough. I hope you do not look up for solutions as well as hints to questions online. And you do it honestly. So I hope you understand these questions and congratulations on finishing this lesson. The next lesson will be a final wrap-up of this class. 13. Wrap up!: Thank you all for taking my lessons. I hope you enjoyed them and found them challenging enough. I've already made a few classes about machine learning, that is image classification. And more glasses are coming soon. And I hope you guys enjoyed. So please leave a review as well as pleased as a class project and shared with the rest of the class. Thank you once again for taking my class.