Python for Absolute Beginners | Dilip Krishna | Skillshare

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Python for Absolute Beginners

teacher avatar Dilip Krishna

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

62 Lessons (4h 18m)
    • 1. Course Overview

      2:30
    • 2. Python Introduction

      2:49
    • 3. Install Python

      4:31
    • 4. Setup Environment

      3:14
    • 5. Basic Syntax

      5:23
    • 6. Python Identifiers

      9:29
    • 7. Data Types

      3:23
    • 8. Numbers

      1:49
    • 9. Numbers in Practice

      5:45
    • 10. Strings

      4:06
    • 11. Strings in Practice

      9:16
    • 12. Lists

      3:27
    • 13. List Manipulations

      2:31
    • 14. Lists in Practice

      8:37
    • 15. Tuples

      2:50
    • 16. Tuples in Practice

      3:44
    • 17. Sets & Frozen Sets

      5:56
    • 18. Sets in Practice

      10:22
    • 19. Frozen Sets in Practice

      4:28
    • 20. Dictionaries

      4:13
    • 21. Dictionaries in Practice

      9:53
    • 22. Taking Input

      1:40
    • 23. Taking Input Practice

      4:38
    • 24. Operators

      7:05
    • 25. Arithmetic Operators

      1:59
    • 26. Relational Operators

      2:27
    • 27. Asssignment & Shorthand Operators

      2:40
    • 28. Logical Operators

      1:43
    • 29. Bitwise Operators

      1:34
    • 30. Identity Operators

      2:37
    • 31. Membership Operators

      1:30
    • 32. Decision Making

      5:26
    • 33. If statement

      2:51
    • 34. If else statement

      3:32
    • 35. If elif else statements

      2:49
    • 36. Nested if statement

      2:31
    • 37. Loops

      5:33
    • 38. While loop

      2:11
    • 39. For loop

      2:34
    • 40. Loop control statements

      4:51
    • 41. List Comprehensions

      1:44
    • 42. List Comprehensions Practice

      3:04
    • 43. Functions

      5:03
    • 44. Functions in Practice

      3:17
    • 45. Function Arguments

      4:51
    • 46. Required Arguments

      2:43
    • 47. Keyword Arguments

      3:58
    • 48. Default Arguments

      2:51
    • 49. Variable Length Arguments

      3:14
    • 50. Scope of Variables

      4:14
    • 51. Program on Scope

      1:57
    • 52. Files

      5:29
    • 53. Write & Append to File

      5:01
    • 54. Read from Files

      2:03
    • 55. Exceptions

      4:47
    • 56. Handling Exceptions

      5:26
    • 57. Raising Exceptions

      3:11
    • 58. Iterators

      1:54
    • 59. Generators

      4:22
    • 60. Generators in Practice

      5:23
    • 61. Introduction to Decorators

      10:46
    • 62. Writing Decorators

      4:05
  • --
  • 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.

27

Students

--

Projects

About This Class

Learn Python Language without any prior programming experience.

This course will help you to understand and use the concepts of Python and make you a great developer. Learning Python can be a great advantage as it will make you stand out from the rest of the developers.

Python is very easy to learn and you can just keep running on it right after this course. 

Start the course and Enjoy it !!!!

Meet Your Teacher

Hello, I'm Dilip. I am a Full Stack Developer. I am very enthusiastic about software development and want to share my knowledge and skills with people around the world.

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.

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. Course Overview: Hey, guys, welcome to Python course for beginners. This causes end at people who want to learn the part on language from the beginning, right from the scratch. So, first of all, why do we need to learn pipe on language? Because it is the most popular and highly demanding in various feeds. One other fields that required fight on language, artificial intelligence, machine learning, deep learning data, signs, development I would be Internet off things. Not only these, there are many other interests of technology. The Python is showing its present so learning vital language to make you a good developer in these areas off technology. So what are we going to learn in this course? First of all, getting in used to the language on, then installing python and sitting at the environment so that we can run pipe on court learning the syntax data writes how to take in because we need to write programs that can interact with the user. The type of operators how to make decisions running lutes list complications. This is an extensive topic. Learning this will give you the ability to write fewer lines off court and then functions. What are the functional arguments, scope of variables, exception handling. This is a key concept because, however, we're going to write programs that will work in certain typical ingrown it's. But when you were writing programs that are going to run on unique other kinds of environments, there is a possibility off Evers. So learning this exception handling they make a right programs that can handle others as well files important up. Reed finds all the open files all right, profiles, generalists and integrators decorators so still discourse to learn all this topics this course will make good not only good, but also if you practice well, it will make a great python programmer. So without any delay, let's go. 2. Python Introduction: Hi guys. Okay, now the outcome of this tees off first lis, we're going to get the introduction of a part of life. So let's see why we nebula high and what it's called. It's first off course is it has application in really schools of Pollitz. They wanted to see what foods that's his handling, big data and performing complex mathematical operations. Wanting big data, we see No, this generation gotta is being generated enormous and moments. So pretending the data by on is very critical, not only handling the data but also perform operations on it. Python does it in very seamless way nexus. It can retreated in procedural function and object oriented. They, you see for now, just understand that heightened can with freedom in three different ways. What are these hold is going to be used. Let's just know about it as we go along with scores. It has quite simple syntax, civility, English language. What does this mean when we The fight on program is almost similar as really an English novel is as simple as that? No, Not only that, Hi constant backs allows developers like killing me and write programs which fewer lines of course, bring in Ian of the language, right? Any problem? It requests a lot off a lot of lines, of course, but in Payton it gets drastically juiced. It works condition platform like Venglos, Black Line, X raspberry pi and many other platforms. So this gives in a great age. Quite a range fight on is critical, and this meaning when you're in a fight on core individuals, each line by line. So that is what it means. Interpreter lives. It is Cordoba. What do you mean, reportable? You see, when you read a fight on program, it can be run on many other platforms. That's what that's what the one of the points that there spoken like No books and decent tackles. That's what makes Fight on as a portable programming language, so it didn't in correction. So let's learn python 3. Install Python: All right. In this video, we're going toe install Piper Indoor environment, the desktop. In running so far this you need to go into your saver, Rosa and type item. And after you search, look for the first link. The beauty of you Dog pie conduct orgy. You get this free counseling and it will direct you to the Titans official. But so when you reach the website, check for downloads, you're going and it will show you download Fight on Latest. Worse So, at the time of making discos, the version which is high tones Hi, Translators. Question is three point it going so she could fit. Don't know. Good. Don't we order, You know, via here focused on working with dingoes. But if you're working it like you line X, Mac or any other thing, you can follow the same instructions, but you need to download hi delusion. If you're working with line of UNIX, you have to click here. If it's Mac year, you needed that. You have to pick here. So the steps that we will follow are very much similar. But the five that people don't know varies from windows to lie next to Mac so make sure little hit the right leg. So the donald is a completely all right and the downloading is finished. If you're going to fight, you see the donor. The installation file appears, and after the installation in the piers, you need to choose either that before installation or you can customize. But for this Coast purpose, well, he changed on model. And before you do that ad tight on 3.8 to Pat, you have to check this button because this will make sure that the python environment is being linked to the part very. But this will make a get it off the all the hectic stuff, adding the fight or adding a part to the Birdman available. And now you start a lot and now sometimes getting storm all right after the installation fees. Tom Ticketless, successful. Now you can close this window, and if you open, Venglos started. Really? Sure. The recently added section fight on ideally model dogs Manu's and also a common like height on three country. So if you open this, give you in Roman, they right, right on course you see All right? No. One, It's pretty. It's working right this is ideal. You off pipe on, and you should. You can also use, despite undergoing a term that you can also live with. Same cool, right? And it's looking right. Not only this, you can use it by going open command problem. And if you take a right on, you could open the pilot on shell in the right. No, to do the same. All right, so these are different ways to write. Fight on cold so it makes shoes that are height on is installed. So let's get ahead and suitable environment to write programs a more concise way. 4. Setup Environment: Okay, guys, No. They're going to separate, right? I'm gon call for this purpose we are using called editor. Mean visual Studio court for deck Go save and search for visual studio. Who? And she's here. Yeah, here it is. And she'd the download button, you hear? Don't first know. Still, if you hit this button, they don't gotta executable file. And if you install that the visual studio cold, we'll be right in your desktop and run and things are not finished. I've been starting uses to your court after installing you open after you've been his mystery, of course, Had over the decision, The extensions. This is street court and I and he ended. Now you can see a number off. I've gone extensions and I think the 1st 1 which is developed by Microsoft and if you see there will be and we stole. But in here there's no install, but because they are already strongly And if you hit it, icon extension will be installed for visuals to be a court. This is necessary if you want to run height on court using business Sharia court and after the high court room. Hey, this is a very, very useful exchange. Because if you install Cord Runner, it will give you on placing like this. What is the use off this symbol? If you're right, any core, just the simply hitting this play button. It will run your code without any extra command. So makes you look in style Cold Runner. Cool, because we're going to use this extension in our coats. So these are the only two things that aren't necessarily stall in visual studio court. And if you install these things, let's create in your file and save it as just not high dot pie. Is that extension use for seeding Eitan programs. So let's side bring Hello world. So this is the fight encore for printing hole And if you're a labour him and you would see the height on Hello work. Here it is. I love work. This is how you're going to run the cold for our courts 5. Basic Syntax: all right, we have installed the python environment. We have settled the zoo story according government Right Peyton programs. Let's get in understanding off. How exactly could write a vital program? What is the syntax? So fightin programmes are organised by lines and invitation. Remember, that item doesn't pride and braces to ticket blocks. So if you're coming from a bag one off C C plus plus or Java, those particular languages provide braces to indicate blocks. Of course, if a few set off interns are included within curly braces, that indicates a block off court in those languages. But tight on if used set of statements are written with seeing indentation, then those are considered a block off court, and the next is the same blocks off, quartered in ordered by line indentation. So to form a block off court, we need to write those few statements with the same number of spaces. So this is an example. So if you look at statements, those a number from one duty for 5678 night. But the first Reese treatments are riddled with the same number of spaces, so those Blanka block one, but the statements 456 have more gap than the statement want to tree, So these belong to block two and again to break the block to the gap is brought back. So statement 789 Duncan blocked three. So this is the fashion in which part on programs are written and the next multilane statement. See if you are coming from a background of ccps Piss Gela. Those languages provide a cynical on trend line, but in Python there is no cynical and to underline the python statements typically and with new life. But if there isn't necessary that you need to extend the line, then fighting provides continuation character. So if you add the continuation character, then it will carry the next line as belongs to the previous line. So if you see here hello World place slash that backslash indicate that the next line belongs to this previous line as well. So this his hobby right middle in statements. This is not extension used in pipe on, but this is a feature that is in vital that we can use if there is any necessity off it. In the next is quotations or accusations. Stinking liberals can be denoted by single, double or triple corpse. So what is a string string is a data type off python. We are going to see a brief introduction and brief concepts off string in the coming chapters, but to introduce what a string string is sequence of characters. So those sequence of characters it there, enclose it in courts. It is called Distributor. So begin your single courts double cords or even took the courts. But but the start and end of the courts must be seen type so a Z, you have seen the previous section the multilane statement. If you want to write Model s statement instead, off using the continuation character, you can insert the stakes in triple court. This will ease the process. Comments. What are comments? Common's are those which are used to write notes for developers. So comments are used to write modes for developers. And it isn't Nordby interpreter. What do you mean by that? When you have a large amount, of course, you cannot write notes somewhere else and referred to the court, which is off huge lines. So comments are written right at the place where we need to understand the court so that a developer. Reading the comments can understand why a particular called is riddled in such a way. But the comments are ignored by interpreter. This gives a very usage off by correct comments on the next is ah has sign indicates carpets. When you put a hash before line off statement, it becomes comment, and the hash cannot be used inside a street because that will make a string a comment. You see, you can also use triple quarter statements as a comic, so we're going to see this in the coming chapters as well. So that's all for introducing Python Syntex. So let's write some programs that are coming chapters to understand how to actually write programs. 6. Python Identifiers: piped on Identify years. What are these? And identify? There is a name used to identify a variable class function. Object Exeter. Once so views I'd interferes. You could Nice. Something like If you want to identify some person, use his name as an identification in a similar way. If you want to write, interfere, they variable Ah function or anything else you given name to it and that means is called and I didn't defy it. All right, so hoping you and I didn't just say it really function, Object at a very low class or anything. They're fuels. Hey, starts with the letter or in the school, followed by zero or more letters under schools are digits. So what does this mean? So and I didn't defend. Must start with the letter of the scoring. It does not start with the digit. And after an indeed afternoon letter are underscore. It can be followed by zero or more letters that can contain a single a single letter or concomitant war letters. But the beginning must be with the letter on underscore. And apart from the beginning, you cannot digit street punctuation characters are not alone. What does this mean so hash question. More per suited sign. Characters like these cannot be inserted into a variable name ordinating. It is a case since to land does capital and in small and a a two different. I didn't defend, so the pronunciation is seen, but the very have written man and man are different. What's the difference? The M is capitalizing a big 1st 1 while in the second it is all in small letters, So these two are different as considered in Piper. So what are the naming conventions? Give unidentified push. If it is a class, it starts with a Purkiss letter and rest off all that identifies like variable functions and objects. You can start with the lower case mirrors. It's an I didn't The CIA has a leading on the school indicates that it is a private. What do you mean by private? If he's provided, cannot be access by anything as outside off that area. We're going to see this in the coming chapters. If the I didn't affair has two leading under schools, then it is strongly private. If it identifies two, leading and trailing underscores, which means whose underscores in the beginning and you're underscores after the name, then it is a language defined special special name. What does that mean? That means if it has to underscores in the beginning and the ending, then it is defined for the languages. It is not for our news. All right, so these are the reserve wards. So what does work? This reserved words mean this is the words are the words or identify areas that are used by pytorch language. These are building to the language, so we cannot use the words as identify us. These are reserved for the language purpose. So take a look off thes reserve words. We're going to see them in the coming chapters has gone. We're going to see ah much use off these cables. So right now, just see them. And no there. Nearly 30 keywords and we're going to use in the coming full blast. 7. Data Types: Now we're going to look it. Fight on data types and variables. What are these? Detonates the various types of data that python can store and use for operations. So when we say that a type, it means we're going to store data and we're going to use for some operations. But there's different kinds of data. So let's see, What are they? Numbers, strings lists couples sets in dictionaries. These are various types of data that python can use. So what are number strings list? Stopping sets? Diction. It's What are these? We will look into these each off them detailed way. We have described each of the data type in the coming chapters. This is Justin. Overview off what other data types that are present in the fight on language. So what are variables? A variable is a day off African memory location used a computer program. So when we say data types, so dead eyes being stored in the computer, but is the very if the values 39 we can't refer to Turkey 1980 in a non discreet way. We have to given into it so that whenever we want to use some value, we can name it. So that is the reason why Python has some naming conventions. Toe give and I didn't affair. So variable is used toe identify and memory location, simply saying it can be seen as a container to store certain values. What do you mean? Whether container is nothing but a memory location, certain values. What is the value? It is the data so refering to dis container, which contains a value it's simply called available in python. You don't need to specify the data type of the variable, which means if you're coming from a C C plus best background when you want to create a variable, you need to specify that data types like if it's an indie gin or float or a strain. But in pipeline, you don't have to splice fate. You just give the very blame and Justin a value T That's it. You're going to use any evidence you want. That is what it says. No need off declaring the variables not only the value of variable my chain, but it's type girls to be changed. For example, if the value is the value of the variable, X is one after the program has only cares. Changing toe 10. The value of the variable is changing. Not only that, but the value off not only the value effects but also the type off externals change, which means the value of one. Can we change it to some text? Some string anything else, So fight on. Use a very freedom to change the type off the variable also, so this is what decorate and variables us certain, So let's get in complete detail about what data rates you could use. 8. Numbers: numbers. This is the primary debtor. Die invite Online members are used to start in numerical rates. Maine is indigenous in indigenous. There are different kinds off indigenous as well. I mean, there are different notations off numerical values. The 1st 1 is dismal. Reds retires off. Be stead like usual. Well, is that we use in mathematical operations. Next is opted. This is based eight. Why are we trying to represent local and must use the rotation by pre fixing the values, with zero followed by small or capital? And the next year's exhibition? This is a 3 60 but these values have perfect by zero for West Monix or capital ICS and the last year's violated these off base to these values are perfect by zero, followed by small B or captured in the next days. Floating point numbers. These are the values that convene factional part as well, like 42.11 don't accept complex numbers. These are written Israel part plus imaginary part, so these numbers are represented by three place five G. All right, these are some of the types of numbers you to using Pitre language. Let's see how to use them in programs 9. Numbers in Practice: all right. You have seen was team to get here on this. It will be music. What kind of data? We can store and manage related. So let's learn how to write programs using news. So we've been resumes tree accord and create new fi right program that I'm going to tell first is decisional bags. You see, disease, a comet. We're going to see how to throw. This is rounds. As we have already said, We don't need to space for the data right by the store brings you pipe lines. The first I just value landing. Yes, there is no cynical. And And Eli, just the new night indicates the end of the first lines. So fresh on your school value. So do you think? Yes. Tell him what values were. Listen, Ben. All right. Next we're going to use often valleys so under school. Vast. It is prefixed zero, followed by K, the small or capital. And I'm going to give one. So next we're going to use excited. The single Exxon has zero for my ex. And then let's see what this value news in different traditions. Go on. No, thanks. The school zeal for you cream bad use these different relations of dismay values. But I wasa mentioned refraction then, since with those are throwing boys in English. So how do we show it is that simple, as we have done for missing values is the same procedure from throwing point numbers as well. You're going to school that so that's drinking as left. So the last one is competent. So as we have seen that complex where you must have really part and then imagine it so to the school, read between the real part. Yes, imagine Park gi so you can actually get each of the venues like we can access the real part and imagine about individually. Let's get real. You the real value calm I make you give the imagine. So let's see this life as numbers doors. Right then, As you can see, you guard all of the numbers car. So let's go here and run our program and see the okay. You got it. The discipline dwellings is made 10 monopolies aid 10 excellence machines, one Syrian binary stoop. You can see the floating Barbara things and we have access the real part and imagine, but you see a come on school. Well, that really steep 0.0 and I'm at which is imaginary is 5.0. So these were understood that how do you use the number standard I how to store them out of existence were seen. So as we go along, the course viewing use dizzy numerical data so them and cost in different races. So that's all for now. And let's get introduced with another data tie in the coming chapter. 10. Strings: strength. What s screens? Strings are sequence of characters indexed from zero to the land of string. What do you mean with it? Sequence of characters is nothing but text there. If it is a one character and another character, they come to the same way. 123 So many characters in career to become a sequence of caps. But you should have seen first character. We call it zero camp and it starts from zero and the end off. The car sequence is so indexed by the length of the string we're going to see visually as But how do we create a stream radio, as we have done in human ical data, the same place in the text to the village because we don't have the space between it and I have been preyed on. It is very easy to create very boots. It is an example this is using the single words stubbled using any kind of course doesn't matter. In title, you can use any course as long as the beginning off the court and the inning of the port of the same time. All right. If you want into court in your text, it means they want to insert what's inside the stream. Then you have to use a backslash character so that your string doesn't end when it sees quote inside. I only explain in the next video detail Lee, so that you'll understand how to go into court inside a stream. So this is how a string the store store the variable with hello at the Stream hitch is zero tendex e. Is that the first index? The boat l started 23 on the five foot. Next is whoa. So there's a concept of negative in Dixie. All right, as you read the point, what I have said, we've seen through it like strings could be indexed the length of the string. And we did everybody. The function Indian off stream, As we have said, this is where the similar when we have neural, C or C plus plus language as well. The injection starts from zero for the length minus one. Because we're starting from Joe between 63 characters, the last one would be foot, But invite on. There is a great feature. What is it is a negative induction. If they wanted come from backwards. This stuff going to again and coming back, we can simply refer to them as minus one as the last captain. Minus two is them last but ones and come down to minus off length of the street. Because zero is used as the first index, we come from minus one to minus of the land. We're going to see this clearly in our programs. So another feature, the strings and beautiful. What do you mean with it? By phone? Strengths cannot be changed between is trying to change an individual character raising error. We're going to see this as well. Although we can change the entire variable, different stone of the street. What does this mean? He cannot change an individual character off the street. But we can change the entire strings there like a city called. Oh, hello. If you change the second position, that means zero is hit first. His E in the second is l. If we change the first l capital, I will reason error. But if the completely changes, it s variable too high. His accent. So this is a review off strengths. The next week, we're going to see how strings are used in programs. All right, Thank you. 11. Strings in Practice: Okay, guys, No. You will come to the programming side of streets, as I have discussed in the previous video that the string properties and its features, how it behaves. So what? IDs qualities and how we can use them in programs. So let's seem program. It can. So I have kept some desk here. The first task is creating strings. All right, I said that we can create strings similar to new miracles, but we can also create strains. But is a single courts, double courts and three quarts. So let's get ahead. I'll create a string variable with first single quotes, my text condensed the data Sindhi quilts, and the next one is using double quotes. All right, that's great. And now with triple courts as well. So let's see. Hold the coming out good. It's what? So let's see whether they work or not, I would have run the program you see here, huh? All off them works because there is no difference in how we use any quotes, as long as the starting and ending courts match off the same time you see the foot God note , but as we have deserved, So let's get to the next stage, I said to insert what's inside the string, we need to use the back second. I have kept another tasking. The task is to bring sun rises in the east with East enclosed in courts. So let's do that. So I'm going to give the variables name used. Underscored string is it will go. We have to insert text Sun rises in the used East is enclosed inside. What's so backslash words? Yuste and then of the backslash and another North. So, as I have said, the East is enclosed inside quotes. So let's see how this is going to work. Spring East, underscore stream. So let's run the program, huh? You see, we have successfully in surgery east inside the books. So this is how you mean texting type boards inside the street? All right, so next get to the next desk length of the stream. I've said we can use limb function to determine the length of ST so we have a few strings created about for each test. So let's bring the land off the first string. This sport, you see the lengthy study. If you can calm them, they're going to result in 13 characters as well. All right, and the next reason. Indexing. Let's to the heading as we're indexing. So, as I have said, the fighting strings can be indexed so that we can access into do captain for the string. So have you seen Yes, one has single gorgeous string. So if we can access each of the individual Cater's let's Say s been off zero, I think has been on five. Let's see, what's the open? Oh S is the 1st 1 and even with the 2nd 1 is open. So far, so good. What if you're going toe access? See some sequence inside the secret school street. Then we're going to use Slaten. This is a new guns, which means if we want to access a subsequent, for example, even to access 0 to 5 insurance zero it and fifth in New Delhi campus. You want to access all the characters between zero and five. We use slices. Let's see how we're going to get out. The slighting Wallace as zero Colon fire. No, this one much. Give us what we have designed. That's from the program. You see, you have got it a small differences that when we apply Slicing Eitan performs, slicing in this way you could get us zero character, first character, second quarter, third character and full but nor the fifth if you go from zero Colin and fine minus one. All right, this is what Python operates when using slicing. So, so far so good. We have come so far. We have been a lot using strings, but we have fleshed. We have got left to cast as well. One is native indexing. So we have seen as funny in single quotes as me and test them using zero and fire. Now we're going to access them using negative indexing. So, friend, a spinoff minus one. And bring this man off. Tu minus three. Let's see what we will get the most open when using need to index of the last two light smallest anti because minus one he's s and minus and given me for my mystery. So that is how we will get open when using native index. All right, immutable strengths. This is a very important thing because run off beginners thing that they can change the stream debt up by accessing into jerk headrests. No, that is not going to happen with tighter because part on strings on your you can't change individual characters, but it contains the entire data. So let's take some new streets like Old Underscore Stream equal under discussion is called Hello no Axis, its third jacker using fine. But if they tried to change it, scared to go I Let's see what we happen. Let's prove him is doing that. It couldn't being a problem. You see, it is already it is already showing, but it's looking. It's run the program into what habits you see this resulting in type er because str object does not support item. Assane me So you have understood we cannot change the individual characters, but we can change. You do completely different. So let's see what happens. Clue word. The same variable is completely changed because willing change the individual characters, but they're completely changed. Turn other data because waterless cause strain is a variable fight on variables are objects . The oil on this question object is pointing to hello in the first phase. But as we have changed the world, the same variable object is pointing, covered in sure hope. So as we have seen how strings behaving by dawn, we can want to next subject 12. Lists: All right. Now we're going to discuss about another data type called lists. What are lift? At least it's a collection off objects. It is an ordered group off items arguments. What I mean by that It is sooner tohave an Aryan see job R C plus plus the similar to those kind off data types least, is a collection of object, which means the list can contain a group off group off another day today. Elements. And what do you mean they're ordered? Group off items are elements, so this actually means that whatever you put in to the list I list as items, they're going to stay in the same order. The order of the elements that you have pushed into the list is not going to change at any point of the time. They can hold multiple values off different candidates. If you have observed in the strings there tonight, it can only contain characters as a sequence. But in list. You can actually store values off different data types, which means a list on container number, a character string and sure, and when we actually store items into list, we can also access each of the individual item by index similar to a stream. So the dynamic as they can grow in a program and run or shrink as well. What does this mean? So we have created our list at the beginning off her program, and as the program gets executed during the course of program, you can add some elements to the list. You can remove some elements from the list. So what does this make? So A list is a mutable object, which means the elements can be removed so that its size decreases and elements can be added to the list so it's size increases. So this is the real Ishtar. Represented. Lists are in closed between square brackets, and whenever you're ready, each item do items are separated by commas. Let's get know the properties off list their order, which were already discuss. The order in which your items to the list are mending in the same order, they say, is my very did you already discussed. We can add elements and we can also move elements and elements can be accessed by index. They're mutable, which means an individual item off a list can be changed, which we're going to see in the next radio off how to actually program a list their nest a bit. This actually means that a list can hold multiple values off different data types. It can also store a list inside a list, which means nesting a list inside another list is what makes this point meaningful. So this is the introduction to lift. So let's program it and know how to actually use listing or programs. Let's meet there. 13. List Manipulations: Okay, guys, we have seen lift. And how did Oh, they're defined. And what are the properties? Listen, manipulations. These are some off the vase we can use to manipulate the list items and to add elementary move and much more. So let's get ahead and see what are they? So the first is a pin happen is nothing, but it adds an element to the end of the list. So if we put if we used this matter, the elements that we're going to put in the functions parentis is are going to be inserted at the end off the list fought off I, which means it removes androgens, the ICT element from the list. So the eye is actually index off the list. So it respects for the index. The element which is in the particular index off the list, will be removed on the next. To his extent, it is similar toe happen, but we can use this mattered to add more than one element which means list happen. String guidance also view more filament. It is similar to pop, so what it does is it removes a certain value from the list index, so dysfunction is actually is usually used to find the pushin, often Ilham. So I ve given Element as a perimeter it Britain's the index or the position off the helmet and the next year's insect, So a pen in exchange are used to insert elements of the end of the list. Right inside can be used to add an element of the specific index, so instead takes two parameters. The first is index in the next element, so the element is actually in center at the index. So these are the methods are very common methods that are used to manage plate wished. So the next video, we're going to see the programs. I mean the next video. We're going to see how to program lists and use them in any program that you want to write . So for now, that's it. 14. Lists in Practice: alright, guys. Well understood about least we have seen what? Their property, sir, How to define this and everything. Let's program bliss and see how we can use listing program. I've got some comments here if you look at them creating a lessening the land batting and removed items in Electing and Mr Days. So these are the prominent and primary tasks that we use in lists. So let's perform them and see what actually happened and how to use lish. So the 1st 1 is to creating a list. So let's begin our program. So the 1st 1 is to create a list. We have said that creating a list is very simple. We given name to the list. Adjust. Let's put its name as list. One cool and the values off list are enclosed between square brackets and do another square bracket. So let's give some element Street, for example, 12 and three. These are the least items, so let's save by pending list items. Fish die dance this one. So let's run the program and observe the result. Here are the results The list items on 123 All right, so these other new stadiums So let's see. Blend off the list she see here, then off list. This is the function used in the case of strings and Lift to deter, Mined, lived. All right, and let's bring the resulting get the length of Alicia than the English history. So we had three Iridium's. So let's add some items. Least one dot append. All right, so we have said the lists can handle multiple data type elements. So until now we have kept only integer values. So let's add a string item such as screen so and bring the result off string. So let's see what there isn't. Please. You see you're successful area, string it. So this proves that lists can handle multiple data types. So there are two ways off remaining items from this one is very moving the last element, which means the right most element on the second ways by actually removing our element from a particular index. So let's see, what of them the 1st 1 is actually removing the last straight evidence in the next way is by removing. Actually at the particular LEX board, matavz are off Simley. But when your speech for an index between the parent is, it removes a particular indexed element. But if you do not express train index, it removes the last state. That is the only difference. So let's remove the element at zero pushing. It's a brand regulating I, um it's specific index. So let's see. What is the reason? No. You see, if you ever did the string and deleting at last item will remove the string because there is the last time. So at a specific index, which means we have given zero. So if you see, we have ground zero remove. So zero element is one and one is removed. We have only elements cool and three. So let's see how we can index elements. This is very similar to strengths. So list one off zero. First item brandy. You see the first rider miss too. All right. So we have seen a lot off them until now. So let's get rid off all listings and focus on only Nestor lists. So if you printed, we have 123 at the list items. So right now we want to create a nationalist one. Do you mean that that list inside a list? So if you give another list. Let's put them in 456 So list. Internalised means we need to add list to entirely list one. So let's put it that way. So the element we're going to use is leased to. So actually, we're putting list. What list, too Inside list one. So let's see. What is the result? Mr. List Next one. So let's see. That is Ah ha! If you observe it. 123 And the next is a list item consisting 456 as elements. All right, so this can be indexed. So if a list contains a list, how can the internalised elements be indexed? So, basically, we have three elements with zero index one first in access to the second index s three told index is actually list to element. So if the print list one off three, you get the list as open. You see 456 So Vidino that list three list one off reserve list. So now we have access to the published. So now vegan use this one to actually index the English stalemates. So list 13 off zero gives the second analysts first element and one. And do Let's see, though you see well, successfully access the in early still. So this is the way we can program lift. So this is how we use this and the coming chapters way. See some other data structures on. After that, you need come again back to this concept called lift and see how we can write them better, So let's get ahead. 15. Tuples: All right, guys. Now we're going to see another debtor structure called Couples. Water doubles. A couple is an immutable list. If you careful up to the statement, it is a list which is immutable. So if we remember what we have learned in list, that list is mutable. But a couple is immutable list, which means cannot be changed in any way after that's been created. It is the main reason why it is called mutable, and my list elements are enclosed within square brackets. Double elements are enclosed within. Parentis is once a couple has been created. We cannot add more elements suitable or cannot leave remove elements from it, which is the reason why it is called immutable because we cannot, Admiral man stood. We cannot move more elements from it. Once it has been created, we can either access the elements off promotable or completely during that is that is what we can do with the couple you can't add. We cannot move any elements from it. What are the benefits of using a couple first? Weapons are faster than lists. If you know some data doesn't have to be changed. You staples insure off list to protect against accident changes. You see, sometimes we might have some data that shouldn't be changed while we're on the program. In those cases, we used tablets because if you're working on a project that has, like, 10 members of the team and available created by some X person might be changed by a person , Why? But there is a necessity that the data doesn't have to be changed into available. We need to use doubles, and couples can be used as keys in dictionaries. While this can be done with lists because lists are beautiful and couples are immutable V use double, says Keys. We can't guarantee that none off its elements are going to be changed. But in list, the elements can be changed, so this mutable and immutable property will helpers in couples having a skis for dictionaries. So in the next video, let's learn how to use doubles 16. Tuples in Practice: All right, guys, how we're going to use couples in you see, Arc, a few guests here This is creating the boots, letting them and changing enemy the previous actually unseen, that apple elements cannot be changed. That that's right to demonstrate whether we can change the element or not. We're going to do this anyway. Changing amendment is not going to happen with doubles. So let's begin by creating a couple I You The name from a couple is my people, My underscored. And as I have said, couples are include sitting parents for Berries. Parent sees one. So I'm adding damn it! All right, so I bring my couple here. So let's around the program. You see my couple items one in the So now this works correct. So let's next values. So disease works in this one. Lost this next. Let's see, by running the program No, we can index the items as well. All right, So the last final guest, Let's see, by changing the element a couple. So let's change them. My underscored couple off. I want to change the value one in my Topol to fight so on accessing it and I am changing five. Let's bring Let's assume that it works, right? And let's go couple items. So you see and then the indexing Everything works right. But after changing, says hyper couple object does not support item assignment so that it's we cannot change elements inside a couple. So let's try by adding more, not at end quite. Let's see whether it works or not. You see, double object has no attributes happen, not just attribute happen. But we cannot add items to trouble after it doesn't create it. So this does not work. All right, so this is what we're going to use. This is how we're going to use triples. There. There is a dead of privacy is necessary. Couples are extensively used. The Japanese are very good when that changing is not necessary. So with this closing couples, we're going to see that instructors again after few concepts were going conceded, Moby is in a different written after lutes, so let's get ahead. Didn't see the next data structure 17. Sets & Frozen Sets: All right, guys. Now we're going to learn about another registry. Two sets and frozen sits. These are part of the same data structure, but these two operating a different Let's let's see how you work, Set contents and on ordered collection ALS unique and immutable objects. So if you kill a judge's statement, the important thing to the first it is an A Nordic collection. Teens can contain multiple objects despite its for the collection, but there is no order that's maintaining like lists. We could listen in order natives. That's it's not harder. And the second thing is there are few need, which means you can have an element only one time. You say there's no petition a lot. The second is immutable object, which means by your credit incident, I didn't seem to say it. They must be muted, right? If you take example, at least this cannot be a part of set. So these are the three important thinks that that have been told in the city sits on a dish soap bubbles cannot have multiple occurrences of the scene. Really. This is what makes the segment complete these off unique objects, trees, multiple occurrences off the same element in order. Lo between, listen to us, you can have multiple occurrences. Seeming See is we want to create a sick call the building function set with references. The sequence or other object between you can use this set function toe 3 86 Another type in how to create a cities we can use. Curly braces insured up the building function to create a set. You see this point states again just first since doesn't allow any neurologic. It's like least so this cannot be a part of sets. Those sets cannot contain metal objects. Sets are really you see. The first statement isn't trace its immutable objects in the last year. In one sense, it is if you give, really do it. The first statements is that it cannot contain your tweets sent content on me mule blobs. Why last sequences? The sets are really between. Objects are not in beautiful, but that sex can be. You can get a good understanding of this in the next switch. No, first since it's these are similar to sits, but these are immutable trains, mutable sets, which means set some really between. You can change the elements inside, but through since it's means they're computed pack with no changes allowed for set me used building function. Separate parents is the case of frozen sets. We used US Britain function presence. So what other operations that can be applied of sick So in Novia will discuss yet some of the primary and common operations while we have a wonderful operations apart from them. The first is living, which is used to add an element to the set, and again, the element has to be rude. Here. This function is used to clear on the pencils, which makes the sitting capri because you're such shallow propia of the same betweens a minutes once it a copy into another different. This is not a good instant difference off who are more sets. As in music history, you confuse minus operating between it, said one. Convince some elements and say who convince some different limits. We ve want us get one of the elements didn't not in each other. So dysfunction regions elements that are Jimmy when both of the sets of combine discard a filament, which means it removes an element. So Regan uses function to space. Fine element, which has to be him. So this function, you know, do anything. If the element is not in the set, you feel it is similar to home start works. But if the element is not in the same there, this one sugar is this a Kia Union office? This one time we were done. Combination of juice it's between. It combines both sets and forms and others in the section office. So dysfunction is used. Do identify elements in common in board sets. Oh, dysfunction most and detention. Arbitrary sitting. Which means since it does not made in any order, what function can't get in the VH One minute is so the most intense and arbitrary second. So these are some common operations on sets. So in the next lecture, we're going to see how do you set in programs and let's get ahead 18. Sets in Practice: Okay, guys? No. We're going to use certain programs, only used them and then operations. So I have got some Commons here for each of the operations. Let's begin a grass. Very fashion is creating this that, you know, we have this off in search. Using function was in confidence. So the living god isn't remember, He's it must be so that list created. So I'm sure you would agree this sick using the looting function. So if we have my Angelou's to call some units 13 so now you can create said one was in the SEC function like this, drinking what? Not to do the 2nd 1 So this is not easier than I agree. This is Let's set places. That's one any and strange. I can see the first city. One of few incidents. It is wanted. So now we know have agreed to set more grease. So, do you know we have a function and Redding's So I wonder ad for the trusted I remember four . All right. And now, uh uh, four. So the next one is tow us the city. So, uh, you can you being used every function on either of the sits on hold this it is created Once he discreet ID. You can use any emotion regardless of home. We have created it to set one dog just gone. So let's you see removed so convinced only one in four. So far, so good. So So let's use the function. So its rules and Stancik. So the agent that is no you So So let's leave it as gay. This the human one. So this is the bridge. Second said he wants. Let's see what Prudence? Yeah, only three and five. Because the one is remorse on the set. That's great. And you know so you know, operations, incense, the difference Union An intersection, These three operations. Another set. So one decisions off said All right, so this'll this is 14 because those are the differences between want sec one go. This is another modern holdings difference, one minus said. And no, you do the same thing and let's get busy. You see border, so you should off using dot descends, but also using minus because Israel's get the So I watched his union so so sick. One dot room I said, Do so Let's see. You know, 12345 because that is the union between his combination of all these. So let's get real. Actual said Wonder Sexual. Now let's let's see, what is there is dissention. Do you think this is the end of this common between both the sense the last caught me and clear. So So what this copy does is in creates you can set. Oh, the copy phones an operation, which means all the elements from one said creates call. Beautiful school set said one. Can't be. We see a copy in Wisconsin is one set 100. So for clarification, let's bring 61 as well. This is the same one ordinance and insisting the last one. There's nothing but here. So dysfunction performs an operation which you must all the aliens and makes it an empty seat. So let's perform. We don't set through so off the do you. So what we do come t o It is white function, so these are the most harm Appolicious perform. That said, Let's get to the next 19. Frozen Sets in Practice: all right we have discussed about sits in the previous lecture. Now we're going to see the part offsets frozen sets, so this is similar to creating a set. But in short, off using the building function set or callouses views the building function frozen set. So I'm going to create Sit with me if under school said on the booting function, frozen on discourse foods and said. And you need to give any terrible, which is a list. Bring the items. And if I go on, it isn't any one group pre presidency. So these are the items. And, as I've always said, Frozen said, does not elevate me any compliments rule. Nope. Elements and nothing like so we can't remove elements we cannot admits. It is immutable, all right, and a lot of the operation that you can perform a difference union dissection. And these are the places that we can perform in. The food is inside, so if effortless Cosette is first it you're going to give us, I send a school set equal who frozen I'm sick. 135 That's no singer. The previous. So that's one. The program I just put 1234 Insect 135 That is great. So let's see how our did this pain difference difference. Homer on this was set dark difference that Sanders said on the program. Again see the differences, too. That's the difference. The union. Let's bring school grammar. Game one. Do three inside these. The result Off union and now see what? The intersection with terrorism? Is it working? Pleasant said. Yes, it does. Let's run the program Game one and three other intersection visit so you cannot remove limits, but you can create a copy off the presidency. So have fun. The school said. Underscore copy from the school sick. So let's bring Prince the program again. Yeah, I guess, is a quantum three quantity shrubs. The frozen said 1st 1 It's one between the second cousins, that is 1 to 5. The district's. So what is the difference? Differences. What are the first said elements to know the seconds. So one is in seconds. It is not theirs securities in order in the seconds So it is the 1st 1 in the end result off business and three is contain insect, so it will not be part of the difference with so day elements, which a contending sect, one but not contingent, said do of the risen off difference in the union, which is the combination of all the elements in boats. It intersection is the result of common element the sets mode of this. It's finalists. We did a copy of this. It so did this. I hope you're clear with six concept and let's get ahead with another data structure. 20. Dictionaries: Okay, guys. Now let's learn about the structure. Dictionaries Dictionaries are on ordered key value pays. So these are similar to set in one day the water on order so they don't need in order which we have certain items. The next thing which is which differentiates addiction it is from the data structures that we have discussed earlier, is that these values are key value pace, which means every item has a key and a value, and they are maintained as pace okay, least payments or access by index. But in dictionaries, their access keys. So if the U number if we get back to list. So we have access to the agreement English using 0123 as index. But in dictionary is there no in Texas because each item has a key and we need to use the key to access an idea more indexes and each element is separated. Another element by the use of commas and all the elements are enclosed within curly braces . So let's see an example. You see, we see we're seeing and dictionary here, which is named that letters which contains year apple be born, see cat. So they're three elements injection is the teach off them. Having the left side value is key on the right side value as the item that okay and maybe see a keys apple ball and get our values. You need to understand one thing which is addiction. Ity can have anything as a key but not wished. You can have number strings, characters floating point numbers on also like a couple as a key. But not least, the coalitions are beautiful. All right, when it comes to value, value can be anything and even emissions with you See, in this example the alphabets of keys and works of values we want Oh, we need to have a value we can be They can be accessed only by keys. So what other operations that we can perform on dictionaries the first years reminding the length using dysfunction. We can know how many key value pains conviction delete off. Deep off gave, which means D B. L del, is the keyboard. The Afghan. It reminds that bees the name off the dictionary and the braces and the cave at which which is going toe, let us access an item in dictionary. So K is the key, not an index. This is similar. Do how the bob off dysfunction is used to remove a key along with the trial. This similar to delete operation. So if this piece for the key to the pop function, it will remove the key in its value. So the item pain deleted provided This is different from pop because poppies used to Rio a specific element. But pop item it, you know, some arbitrary element. The former, for example. So here the items are returned in the form of trouble. Get off key Dysfunction is used to access an item using kids. So she if he passed perimeter key with the get function, we can receive the value off the key. So these are some of the common operations which is performed on dictionary. So the next lecture we're going to use the dictionaries in the program and learn about 21. Dictionaries in Practice: all right, let's know, learn how to use dictionaries in program. So, as in previous lectures, I have kept some comments here, too about what are the tasks that were going to do with dictionaries? See creation, accessing elements, adding elements length delete operation pop pop item and get a vision. So let's start with the first let's created. I'm going to give my dictionary name my underscore dicked equal to when dictionaries are in closed within curly braces. I'm going to give Oh, some keys, Right One one do And three. You see, this is my dictionary. I'm going to bring the reserve. So let's see what is there. See the dictionary minutes 123 So it looks like So this is how you create a dictionary. And I have said that we cannot accident elemental dictionary by using index, but by keys. So here, then beauty. Just 123 are the keys while the strings alphabets like bo and you want these values through the strings are the values. So I'm going to access this second. So how did access my underscore dicked off to? This is how you access while you is June. You might think again. This is not index This key. If you look at here, you see, let's run the program. You see, the second item is two GW you have got There is a So this is how the axis limits. So we're coming toe adding elements. This is a very, very very with the simple way have you add elements to addiction? So the items in dictionary are key value, peace. So you need to have a key and value so two added. So when you add it, you do you take the mean my underscored it and in square brackets to give the key for suppose I'm leaving a key stream like son and details of value. You have to put it on. You have to ascend to the key. So we use equal to give this key value, which is I'm going to give raises in the East. All right, so let's bring it my and hello. So let's run. The program is he rises in the east. You see, that's how you can add a terms. So if you have, though, he every year using 123 or vintages and here we have used a string all right. You can use floating point values size with my underscore. Dicked off 3.14 lets you It is the value off by and you can honestly my underscore dicked Oh, you can add a couple as well. So Apple Cider Parent is 123 I am going to give Daz three numbers. All right now, I'm going to bring the dictionary. So let's run the program and you see 123 in string Sun rises in the east 3.1 for floating point number with string years. It's while you buy. You see the couple one putri with three numbers string as developed if you want to get the value. Also that dictionary off the item which has stopped. Liz, it's key. You access meeting this week. My underscore dicked off. Oneto is the key. So on the program. If you see dictating with the plasticky three numbers, it is senior. How could how you do for indigenous string or anything else? So we have known how to create a dictionary of access the elements off head element streets . Now let's get to the operations so length length of the dictionaries. Nothing but You know how many items we have stored in the dictionary? So we have a method. Call Lynne off my underscored addict. If you run the program length off dictionary six. So we had six items. Six key value patient dictionary. So deal it. So I'm going to delete something from here. So keep were did a deal space. So the dictionary name. And what is the key off off the item that we're going to deliver. So I'm going to delete the value t run the program. Wait a minute. Let's bringing the dictionary now on the program. If you see here we have 123 as well. But after deleting one toe care. Come, son. The value with three s key has been the later so here we have won't function. Dissimilar toe Harvey. How we used in the standard All so he had pop Britain's DT right. He will remove the items as well. So let's take it as a result, equal to my underscored off dark off. So let's delayed the item one and bring the result does bring the dictionary after it. How it's going to be So the program Is he here after leading pop off one. The result will contain the value which has been removed this and you want. And after that cop function, if we print the minus, Kordic does not have one as its item. So this is how part function works. Corroborate forbade in French ingredients on average. Three because dictionaries are in order, you can't say my child and we're going to be deleted. Been using populated. So let's began. Put Division Off Corp item in visit playing the result. You see, the couple s key value is diluted. But if you observed in the previous what function the value of diet immature moving has been written. But in this pop item case, we get the key and the value brought in the form of a couple, which is another future hold to use, but which function to use where you're moving writers and the last function is get get, function is used toe extra values often item. So if you use dysfunction, I'm going toe access to use. I wonder this way value, which has some s key, she cries in the east. So this is how dictionaries can be used. So dictionaries are very, very published because it has a key which is different from induction because it is only 0123 But in case you can choose anything any data type other than lists, so dictionaries are quite powerful, we're going to see the use off them incoming pictures. And this is the final data, right that we're going to discuss this coasts. So let's get ahead and see what's next in the course. 22. Taking Input: taking in Bush programs are meant to be in tract user needs to director of the program. So input is a primary way, and which program can take anything that has been given by users. So this picture is focused on the Jamaica programs to you see, we also need to interact with these. So I improvised function. So is the function is what it does it take single from user and then function scored. See whenever there's a good function call. The execution of the program is hunted. User finishes giving you and the execution again remain, and the execution from resumes someday. This is a specific functionality for this in book. Whatever then could is given by the user will be convicted stream. And if you need anything specific, like you need to give only indigent or floor or anything specific need three program you need to pay. Cast it explicitly as you need, so this is very simple function. So let's see how to program using Griffin. So let's write a program that interacts with these 23. Taking Input Practice: Okay, guys, No. We wonder where the program that interacts with the user. So if you have used visuals Sharia court like what I have used in this course until now you need to do us the speaking, which is Go to the extensions marketplace here and typewriter. And when you see the second link here by come from V s core big star and after installing this extension, we're ready to write programs that can taking. You see, I haven't reviewed in the program Here, you see digs, you see Canterbury here we can put any string we want, which is basically it is a prompt. It will tell it will tell you you enter value and then whatever rather that you have enter will get strolling the variable k and we're printing it. So let's execute it. Inter value. I'm read, right Hello for no right. Let's write a program. So I'm going to take very Billa's dear. The function is so inside the parent. This is if you can see here it gets brought, which means if you tell or it will in from the user with the stream It says what you write here, it's like into the value when the dysfunction is it called. It will print, enter value in the music and know that it wants in food. So let's put and do something. And after that, next spring, the value. And now let's execute a program decimal and I'm going to That's indicated. So you have it in this program and vino executed and you see it is asking into something the stream that you have set sending to the function. So hello, little Prince. So this is how you were taking. So let's see. Hotel takes on other functions like I'm going to pick indigent here. So equals Dauth. This is for floor point them bus. Bring that and what does? So let's run these programs and watch what happens. The first is under something. Hi, an indigent 50 50 on floating 500.3 point 14 You see, it takes every kind off people's so decks indigenous, take foreign, take strings and characters, so it takes almost every kind of good. But the thing we need to take a year off he's while good function takes input from the user it receives in the form it off strong. So we need toe pipe. There should explicitly like what we have done for indigent and for floating point numbers . So with the singer way, we need to type casted explicitly so it doesn't have you taken, include from you and let's write some interactive programs. 24. Operators: Let's begin to learn operators in this lecture water over this. It is a symbol that tells the interpreters to do some operation. There are different kinds of operatives that begin using our fight on programs, read many cooperators, comparing a relational operators, Sigmund operators, logical operators, betrays operators, membership operators and identity up operators. These are their admitted operatives, admitted cooperators are used for doing some mathematical operations. So let's assume that the end we have these on the left corner. Off the table, condensed the symbols, and the second column condensed the meaning for the symbols. The third column is an example of how to use the symbols than their cool variables. Two places Relation minus subtraction. Slashes for delusion. Stars from multiplication personally just modules. Which means since the remainder of the operation and double stories, the exponents double slashes with religion. It is just a overview of the symbols that we've been using kind and programs. So I reuse them. We're going to see in the next lectures compassion of relational operators. So these are basically used toe deter mined his nation between two or breakers on a fee, and we have 12 equals between double acquits because two equals. He's used to gain an understanding of the relationship, which means whether both are equal or not. So w equals is used to do you mind. The values are equals, not equals is the 2nd 1 which is an exclamatory mark and equal, which is not equals. And there is an under. The symbol, which is used to do similar Cohen articles, is less than whether that the next he's lesson greater than less than or equal driven out. These are basically similar. So what? We're using mathematics but differences there. Three different operators, which is equals two and not equals next assignment over this operative. We have already used this, this operator in previous programs, which is used a sign of value variable when this operator can be used with arithmetic operators to create shorthand otherness, which means less equal minus equal started cooling tower What Theis will reduce the use age off More very boots. Dictators operators have used to perform operations on the big level off the variables. So Amberson, this year's Anderson the Sultan zero if one bit off is it is ego Arsene been if one but is . One result is one the captain. But if both pitchers same result zero if not there is a big one in the navigational, it flips the values 10 and Children, this is usedto fit the values and double shift topic. I mean, this is a shift operator. The fastest left shift in the next one is a righteous. These are used to more the bigs in the specified from the specified pushing to the value that we s was friended and the shift operatives defied defined the direction in which the bitch has moved. So if you use left shift off return between move onto the right left we use righteous operated that which we were on the right side and then the next year's logical mothership and aid into the opera house you see and or are used similarly because operators but big plays operators perform one brick level by large cooperators performing values. So we need to know to think other than the dead lips that we have discussed earlier. There are two different values which is two and forts deter used extensively conditional statements which we're going to see the next lectures as well. So just move that their core values of the crew and so end Ricans crewing border group, but all regions falls if border forts. Which means if one value off if one really is true or village and crew if both are forced to turn irritants, forts to literally and operator if both are true insurance to if one is quality. Willard and Forth, Andre told, is not operate dissimilar to negation of it changes. Krucoff falls and falls to true in orbit. This is not it. These both and membership operators So Derek. Untrue like ingredients. True, if it finds value in the secrets. What a sequence like a list couple set dictionaries V. If you see the last column, if he a in l. If the value is in the sequence, l it will return crew. Similarly, the next is not it credential. If it doesn't find value, the sequence a knotting Ellis. If he really is not inside the sequence held, it will return cool. The last one is and is not. These motor ride into the operators. Easy construed. It's both variables point the same object. He's not instruments. True, If both were, it was pointed different objects. So these are the operators that we can use in our pro programs. So let's use them programmatically and gain an understanding so that we can use at any point of time that we need to use them, so let's start programs. 25. Arithmetic Operators: guys. It is a program that is demonstrating the years off admin operators Ogre, American. So we see equal to seven Beak orbiting sequel Diesel in the Valley. Sarah be useful in reality. But see is goingto result off if you operation in ad merrick operators. So if you see fascia secretly bless me. This is additional and most my a minus beats a gradient. You will be reputation A baby division double slash b This is floor allusion. You won't be. This is the marginalise operation. You star star B, this is the exponent operation. So you get a visa in Prince statement the same. So let's run the program and see the Yeah, here is suit some 10 seven minus 347 into deep only 17 by three years in prison which is a floating point. King Abdullah It it is division that flow disease will give us the which means it will cut off all the fraction part and it just one is dismissed. He might be is one because seven more three reminder will be one east are start be it is 73 or so. This is how we use admitted cooperates. He performs mathematical prisons. So let's get to the next operators 26. Relational Operators: this lecture we're going to use relational operators are comparison operators. My relations between values on variables. So if you scare free after the first statement in the common section it is we need to understand that these are greatest Britain crew or fourth, because they're used to deter mined relations. So I have already said in the previous lectures that including the data that we have discussed earlier on the lectures, there are two more better. That's a job who are faults. So these are these are very important because they didn't mind the relation between values . So this is the right place will be introduced. Those data rights. So he have, yes, ing a few operators being used The first is equals operator Marty Cooperative, less than greater than less than or equal to or greater than or equal. So it has the value seven and he has the value three. So each of these operators, when used against you and B, they didn't either true or thoughts. So this true or false is stolen c for every up for every operation. All right, so and via printing the value, see for all of these operations. So let's run the program and observe. Have you on the program you see here? Yeah, it could be his fourth because seven is not equal. So seven is not equal to three is true, is less than B is false because sun is not last entry He's greater than be true because seven is greater than me You're hysterical to be force and the greater than equal to B is true. So by this you can understand that competiting in relational operators and used or did reminding the relations in this week. So these relational operators are quite extensively used in conditional statements to make decisions which we're going to see after the electricity on operators. We're going to see the decision making which we used these operators very, very extensive. So that's all for now. 27. Asssignment & Shorthand Operators: other guys in this lecture, if you're going to learn how to use a sentiment operators and shorthand operators to write , do do's and programs. So before we get any forward into the program, let's observe the common section carefully. So he have you have. We're in a small statement which will them unsure how to use shorthand up leaders. So this is the shorthand way off writing in Accord. So this is the way off using shorthand operators. So what does this actually mean? It translates toe equals two year place be, which means the values aim we are going to be added, and the result is going to be stored in years, so you don't have to use any other see as a very big because the value is going to be stored in here. So this results in using less very boots. So if you get into the program the values E restoring the variable years going to store seven B is going to start three, while see is used to store the visit off every operation. So the first operation is assignment. We're assigning the value U A plus B two c all right, and the next are short and operators. We have written Shortened Edition, which means C plus equal to year presence and see calls to see place year, which actually means the value of seats. 10. The value of fear. Seven. So 10 plus seven actual results in 17. So this must be the value off see and shortened subtraction. Short and multiplication shorthand division shorthand More jewelers, shorthand, exponents, shorthand floor division. So these are the shorthand operators and let's run the program and observe the the program . And here are the results the value off cease 10 because some blistering. And if you do the shot and edition yeah, we've got the value right and short and subtraction, multiplication division and all other operators. So if you want to just fire answer, you can do it on paper or calculator and absurd output as well. So this is over you shorthand operators. So let's get into the next operators 28. Logical Operators: welcome, guys, This lecture We're going to learn how beings logical operators in our programs. So logical operators perform operations with trained for because the result include informs So we have toe variables nb which stored bullying their strength force. We have already talked about Crane Falls as death threats. So the end and are and then not these are the large global. So these perform operations sooner Toho and are not in between operators but which was a protest performing big level. And these values perform on very little. That means if the variable variable has true and false in such a way. So if this year sequel, do A and B secretly air be secret or not off DnB So let's run the program and observe the output. So if you have the u. N B equal to force because if one off it is falls, end result in thoughts So this waas your be equally true. Why destroy? Because our results in cool if a drop its value is true not off a and B. We have already home the value off the NBS parts, so if the use not available, it will fit there. So this is how logical operators are used in kite on programs. So let's get ahead 29. Bitwise Operators: Okay, guys, in this lecture, we're actually going to learn between operators. So big craze operators perform operations on the big little off the variables. So we see the value seven. This is the by nature, a presentation half seven. This is the binding representation off three. All right, so the bit with the operators perform operations on these big values. So C is going to start the result as usual for every operation. So we have performed M Person are zor operation, the negation off year which depicts, and the left shift on the right shift. So after your operation, we're also going to print the binder in the presentation off the value see which will enable us to understand in a better way. So let's run the program. And of the yeah, here it is, and person B is equal to three. And the binder presentation is 11 betweens one and troopers here and record one charge to three. The scene of a seven and Zaurus for minus seed 28. And the rights of is one. So this these operators help us perform between suppressions in this way. So let's get into the next lecture 30. Identity Operators: Okay, guys? No. They're going to learn about identity Open. It is so I don't know, Producer used to check by the two objects of the same on knock. They have a point in the same object. So if we see here beginning a local ground, there are two labels. It's Yeah, I understand. So we did remind with these two tables, actually, and it may seem so we have the statement Sequel is in the value sprinter and and in the next seven leak line, we have changed the values off nb id him instead. But be Escudie. So now you can check with Yang be actuated the color, not Eugene's. He's not be. And we tried Which deal? If you run the program you see is B for the first because in B has in one's dream school and he's not be here. You couldn't school because they change. So to be more concise, how do you actually you get this problem? We're going toe to toe mine the ideas of the variable. So when everybody square to the interpreter, even I d to available so, so so ho to determine i d This is a function any off a. So now we're reminding I didn t off the which is ideally off me. So let's do the same. The values have been changed. So let's run the program you can see for the statements are not changed, which means that values off you have seen the good point through seeing identical objects, changing objects and different mutuals. The difference in is be cruel and use mobiles crew. So this will make clear about the identity of operators, so let's get ahead. 31. Membership Operators: of you guys know we're going to learn about membership operators and fighter. So what are membership apparatus? Membership operators are useful in chicken, whether such some value is a member off the sequence. What are sequences? Sequences are like lists, couples, sets and dictionaries. So v how to labels he and be. And we have created a list which contains one toe five as a secret. So we have written a program that better minds, whether the value fee and be a members off the list or not. So if you observe the program here, we have written in my list, which determines whether it is a member of yeast or not, and then being raised and then you can not in my list and then be not in my used. So let's only program and huh in list. It's true. So is the number off list. Being listens Falls, which means B is not a member of the East in organist. His faults, which means, yeah, it is a part of the list to be normalised distributions. B is not enlist, so this is how membership populace, a useful there, used to determine whether the value is part or member off a sequence 32. Decision Making: 100 guys. Now we're going to talk about this. Should make this should make you mine. I need it very early age. Were computers me motion to work along with the decisions until no, we have written programs that do most mathematical operations. They don't need toe blessing calculator Whalen programs because they got a kind of cheap cabinets over there in the markets. We need to write programs that are interactive that are you religion? Um, additions. So let's begin to write intelligent programs from now. So under certain conditions, we need to make submissions because, as as a human being, your distance and depend on the conditions, the situation, circumstances, sometimes sometimes you cry to take addition, which is beyond the conditions. So that is ever the computational that is beyond the mind. But many construct programs. The additions are built upon conditions. A decision has to be made when the Scripture program comes to a point where it has a choice off action, which means condition can result in a choice of faction, which means there are multiple actions that we can perform depending on the condition. So at second point, we need to make a decision so the distant making statements are called conditional statements, and these conditions must evaluate to a the true or fourth when it is true. It didn't stool perform in action, and if not, it tries toe do some something else. So fightin conditional statements are if if Els, his LF ends and nationally who each of the individual off these conditions treatments are used in a specific purpose. Let's get down to that. So we begin with the if statement if statements are used to change the flow of concluding a python program. So I decided a long time that there are not running a block off court or another. We used this if statement, so the concern taxes. So the if statement, along with the condition to decide whether to perform an action of North and the statements and to get the actions, different statements, this conditional statement he used to write block off court If certain condition matches and another block off court, the connection does not make in the previous of statement we perform in action, the condition matches. If not, we don't do nothing and go sequential program. But here, if the condition matches, we do a certainty. If it doesn't match, we do something else. So there is an action if the condition does not match as well and the third is if l if statements. So this statement helps to evaluate more than one condition it runs called the block that matters the condition. So this is a condition in shape, mint and lift means else of condition and statements and then else statement, which means it's a condition matches it, exhibited the shipments. If it doesn't match, it comes down and it checks another condition again and it is good. The statements of it is true, if not if, and this leaf can be extended to as many conditions as we can and the final is l statement if none of the conditions of the matches can exhibit else statement. So this is quite helpful in the reminding What action Super phone when they're multiple conditions to be checked and the last isn't necessary. This statement is used to chicken condition inside another condition. If mood conditions match, then the court is executed. So if you look at the syntax, we have a condition inside and the condition. So when the program is executed. If the condition one evaluates who Coop gets in tired and chicks for the condition, too. If the condition, too, is also evaluated to cool, then the statements are insecure. If conditions on fails condition do is never checked. But if condition one is true and condition crease falls, the statements are not going to be in a cuter. But if both the conditions are true, the statements will be executed so you can ask the as American distances. Necessity depends on your program, and your requirement on how to can out to miss these conditions depends on your requirement . So you have the freedom. Connection adds many conditions. As, let's say so. This is a critical part of making decisions. So let's get to write a program, the dinner minds, ultimate conditions and, more importantly, describes programmatically cool right. This should making programs 33. If statement: OK, guys, Now we're going to write a program that demonstrates the usage off if statement. So we have a task here which states if a number is less than 10 friend Yes. So we need to write a program that takes an input from users because we said we're going to write in tractor programs so the user include must meet it received and it must be checked . It's a number if their user input is less than 10. We need to print. Yes, that's it. Nothing else. So let's begin writing a program. So I'm going toe put my variable My underscoring put equal to what is the function that we use to take input from the user input if we're going toe from the user s and very number because we're going to check if the value is less than than two, it must be number. So when we say a number but input, I received it user input as string. We need to typecast it like in Yeah, Now we have put in India format and we're receiving it from the user. So view building director, part of the programs. So what now? We need to make addition, What is that? We need to check whether the value that the user has entered its less than 10. So if my underscoring book is less than 10 and now we need to put a cynical in here so, so understand and clearly observed the syntax, the if statement, the condition part and a cynical now the indentation. The innovation is important because these statements belong to the, if condition. So now, friend yes, that's it. That is all our program is going to do. So now let's original program. So I'm going to give input as fight. Yes, and now I'm going to give input as 50. It doesn't nothing because we didn't say the program to do something. If this greater than 10. No Visa said it. If it lands and then print ecstatic. So this is how a simple if condition works. So let's write another program demonstrating the if else statements 34. If else statement: Alright guys. Now we're going to write a program which demonstrates the uses off If l is conditional, Street me So we have a task here. If the number is even bring even else in God So really to do cool things. The 1st 1 is the chicken number is even if it is earing friend. The second thing is if it is not even we need to print our So how did you come? Mind a number is even around So in basic mathematics, if a number is divisible by two then it is even if not then it is hard So for example, the number 10 divided by two results in reminder of zero. So it is even. And if number five is not divisible by two because it presents in reminder with one. So it is our so the main concept it is we need to get the reminder. All right, so how do we get the reminder? So we have an operator module is operator deter mines the remainder off so we can use it. So how do you write it? Simple and more do equals Z right? That's how we do it. So let's write the program and see how gross So the first thing is, we need to take the mind square, go and then could should be. Did your format tell the user toe? Enter a number. So you have taken them. Now we need to deter mined, whether it is even our know. So here my underscoring more do equals zero. Now we need to maintain the invitation even. Okay, so that's all for the if condition. So if the statements and the condition of finished we need toe breaking invasion and get that and no right, the else statement and many inundation for the else statements free or on, that's it. You have finished with our program. So let's run the program and see the So I give the 10. It is even. I don't in the game. You off 15. It is on, so it works quite well. So this is how you write it'll statements. We can write it for any complex problem that requires to make a decision and do something and and also do perform some actions. Condition doesn't match. So if else statements working this way. So let's get to the next condition. ISI 35. If elif else statements: Hi guys. We have already seen how these if Andy says. But that came just a check for a few conditions. But now we're going to check for multiple conditions. So disuse, good ability to perform operations. Then there are more than one conditions to handle. So we have a question here. It's a number is positive, positive. And since it is negative for you and Springs, which means we have to do three operations here the 1st 2 years to check them in this positive the next to check with this aiding and the tour actually that it is possible not positive and not needed betweens zero. So we know that any number that is greater than zero is positive and any number that is listening to you that is needed. So let's write the program. So very 1st 1 is we need to take input from the user off. All right, the receiving Good. Now we need to check. It is cost to or not. If mind school people you scared of that zero we're going to bring was and the breakdown In addition, because that's the only statement in if block now. LF my underscored in port is resting zero, then Negative ST zero. So, yeah, we're taking the input from the user Chicken. There is greater than zero less than zero. If open is here. So let's run the program that though. So have you on the program? I'm going to enter them. About 50. It is passed. That's good. Looks bad. And again it minus funny it didn't. Well, that's good. The last case you incidences here. So we have written a program that contest medical conditions and take a perform action depending on the condition that it matches. So this is how you use multiple conditions reading program. So let's get ahead. 36. Nested if statement: What a nice how they're going toe. Write a program that uses nested if statements do some operations. So the task that we have here is if the number is less than 20 and greater than 10. Print yes, so they need to check for to condition. The first is if it is destined, Gandhi. And the second thing is it must be greater than 10 to print. Yes, so less than 20 has nearly 19 members. And the second thing is we need to do to mind whether it is greater than 10 toe. We need a condition inside a condition. The first condition checks whether it is less than 20. The next condition checks whether it is greater than 10. So let's try the program similar way. We We're going to take the input, please. Less than 20. My mind squaring is greater than now. We're going to yes, that's it. Into printed. Yes, it is less than 20 on gravel. That's for later in the program and check deal. People were going into 15. He drinks. Yes, let's enter number that is greater than 20 25. Nothing in prison. Let's and remember. That is less than 20 and also listening. Then five. Nothing happened. So if you see a were chicken can see condition, entire condition. So this is how it helps, too right statements that can handle multiple conditions. So if you observe when comparing this program to a C program has much fuel lines, of course I see program has a lot of things to do. So this is overused initial statements. You can get you unless as many of conditions as you want with this, the end of this condition statement and let's run to the next segment off a lecture. 37. Loops: Okay, guys know we're going to learn lutes. What are you, nuts? Generally, statements are executed sequentially, which means excluding line by line, one after the other. In this sequence, loops are used to execute a block off course several times change. Then you need to do a specific operation a repeated number of times. Then you need to use groups. So if you observe the flow chart below here the top dog is the start part of execution. It comes down. And if the chicks a condition, the condition is cool. It excuse the conditional court and runs and begin checks the condition until and the condition is true. It will be excluding the conditional court if the conditions walls it, return it. This is how lutes work. The first type of flute is violent. This room statement executes a block off court until a certain condition evaluates to true a solar gun. If it says condition statements, but it repeats, it repeats execution off the same court again and again in the state. In the situation off decision making statements, it just takes a condition and exudes it. One time with the case in lutes checks the condition and you execute until the condition is false. So the syntax or via loop, is why the condition colon and the statements that we need to run repeatedly. So statements were single or block off. Multiple shipments. Do as we already know, the need to maintain the invitation with their block off multiple statements or a single statement for the for it to be in the violence. The loop it words were the condition is true, as we have always said that the condition is falls, the look terminates, so the conditions falls. Program control passes to line immediately following the loop. The second night is for there's the ability to turn it over the items for secrets string or list, and we're already seeing that Strings lists topples a sequin shin data right, which means each of them appears in a sequence one after the other. So we can use for New York carried over such kind of sequences were going toe, see how to use for loose for sequences in the coming lectures as well. So the syntax is for the variable that we used to treat in is a cure. So you have already seen in He's use as membership operator and sequence the statements that we need eggs. Good. So the first item in sequence is assigned 200 on the school, where, in statements executed similarly e title. In the sequence, they're saying to the eternal school grab and stops the and stops when the sequence items are completed. We can also ordered using the secrets index from zero and 10. Read the loop when it reaches the length of the sequence disease. Much more how seat programs, c++ programs, everything. The last year's national loose. This is the combination off for Lupin violence, So Python allows us to you one loop inside another so we can use a for loop inside another sort group, while in Second of the Wild, look for insider, another wild look while inside another file so foreign value can be used extensively. Both combined the last new control statements. These statements are useful in controlling the execution off route, so these statements will change the normal execution of the program. Between the look exudes the court repeatedly when used loop control statements it whole did breaks the control from the loop, or else Britain's the control toe loop from the mission stage. The first is break when views break, it terminates the current group and resumes execution at next statement. When the brake line appears to the interpreter, it terminates the loop and runs the core that is next to the loop. Continue. This statement returns control to the beginning. Off the loop statements pass. It is another operation. Nothing happens when it is a huge it. It is used when a statement is acquire. Syntactical e, but you don't want any code to get executed. So passing use when you need to write something at a particular place. But you don't want anything to happen, so we will use the statements and the next common lectures. So let's quite cool to use these routes. 38. While loop: other guys. Now we're going to write a program that you just y and the test that we have Yuri's. We need to print values that are from 08 but by using while you see we can do this program and secretly by putting Prince statement from zero to it. But we don't want to do that. We want to use the value. So so the condition he has been given, which means it starts at zero and it ends and eat. So so, to start, the sequence must be sealed. So I'm going to give it the value equal to zero. And I need to bring this value until it gets three. So I'm going to put this in a loop. Why value is less than or equal away. Why less than or equal weight? Because the condition is recruit Toby. It good the Via Luke statements. So to execute the statements, while the value has means, I'm 0 to 8, we need to put less than or equal, and now I'm going to brained value. So we need to change the value so that it prints of zero Great, not 10 So what we do, we need to print from 0 to 1123 So, each time, the value resist by one So re are going to changed value but one. So now let's run the program. I lived in the output. Yeah, and we see that would put from 0 to 8. This is how wild roots are used in programmes. 39. For loop: other guys we have seen in the previous section about how to write roots and using while. But now we're going to use forage, so the day after we have you is we need to print each item in the sequence separately. What are sequence or sequences are strangely Stupples sets dictionaries, whatever all of them are sequences. So we take two off the sequence of strings and least and really the Russian of them for your practice. So let's bring each item off these two sequences separately. So I'm going to take a string variable in the stream. Okay? Now what we need to do, how do we use for so this syntax for for new is for and now we use an illiterate available . It can be any very blaming that you want. Just make sure that it doesn't coincide with another variable in inside the program. Okay, So I'm going to use X in the membership operator. The secrets that we want to enter it over call in an indentation. Now I want to print Exe. So this is how you use fun. So before being on the program, let's just right. The core finished as well So my underscore list is called. I'm going to take five numbers and run the loop for, um, I in my underscore list. Prince, I So let's one the program and observe the So we need and restaurant here. We're going to enter Hello If he Hetchy elbow and it breaks here and the next is the list sequence 12345 So this is how the user for look created over the sequences and do exactly access individual elements off the secrets. So the rest of the sequence that a double certain diction is a leftover for your practice, and we're going to get to the next lecture. 40. Loop control statements: Okay, guys, now that we have known how cool right means we need to have an ability to control the needs , how you want. So these are three loop control statements. Break, continue and passed. So these statements are rude control statements. And let's see, Ho used the statements in programs for Demonstrate Break. I'm going to write a program which has a secret off list the elements from one token. But the test of we're going to post from here is we need to print the elements inside the sequence off list. But when it has an element of five, it must make it must not going for the effect. If it sees a five, the programs terminate. So let's write the program. So my underscored mystic would want to do evil by 6789 and 10. So have 10 minutes. So what do you do I to rid of the secrets for I in minus called list? So what? How do we access the elements? It is I that very well, I So what? What did they say? I want to break the loop when it sees a five. So if I is five equals five what do we break? So we break the loop Or else what do we do? You bring the value, all right, next on the program and observed a off So Hillary's If you see values are 12 34 But when it sees a five, it breaks so the loop will be terminated. It doesn't work anymore. So this is how Break Statement works, you understand. So let's get to continue. What is continue continue is used to return the control, the beginning off the loop. So let's take an example. So let's right the courts similar to the previous break statement court. But instead of break, let's use continue. So let's hear what habits for I in mind. So list. If I equals five continue. It's not sprint well values. So let's run the program. You see 1234 No. 56789 10. What is it? Who? When it sees five, it does not execute. The statement says convenience. So what it does gets to the here gets to the building off the loop. So you should off executing your statement. The high value moves from 5 to 6 and the value six will be printed. So this is how continue works. So let's understand past so, so passed it means are used for syntactical purpose. They go have any execution purpose. So let's observe the up and yeah, hold these past So to secure the chord you see 123456789 10 So all the values So what use of past When we want to write some court, you have the conditions you have work you have what kind of situations occur but you don't know what to do yet so use the condition toe See that this is a part of the court The past statement will make sure that doesn't have any Edris are in your six past is going to read cuter in such a way So these are the New Congo statements 41. List Comprehensions: this conversions. These are used to right called a few lines. These are performing lists. So this comprehension is provided legal, right? Called for list which few lines. So you the people step over the concerns way of creating use contents. Square bracket. An expression for the for cause means you are more for a cross between all of the court is embedded inside square brackets. The expression Did your mind what we're going to store the for cloud Greedo the winds of values to create a list. The result is in mulish two, resulting from the bad wording expression. So by evaluating the expression, we inside each of the items into the wrist and result venue list. So if you have the code blue, you see UNESCO list is equal Do square brackets in the foreign court. Whole lines has been changed using this comprehension for one line, of course, you see how concise it is. This is kind off facility that we have in python using these conventions. So just understand that the court is embedded inside the square brackets and the expression would use to store list values. And it is a river for over a range of values is in the firm. So this is to your let's why missed comprehension is and the whole right there. 42. List Comprehensions Practice: Okay, guys know we're going to write a program. Creates a list, but by using the east comprehension. So here we have a task. Create a list which has even numbers as its sequence up to 20. So we need to create the even numbers secrets off list 20 as the range. But by using this conference So what is this? How we wait. So first of all, give your list sequence a name even on the school list. Equal toe open the square brackets. Now the expression What? We're going to stop. We're going destroy the items. So I'm going to put it as I didn't. Now we're going to turn it over the wings off numbers from, you know, the first even and Berries too. But we're actually going to check whether there even are not. So let's start from one so far. Item in. So what is the range from one 20. So the second argument in range must be one added because rings secrets toe right side minus one. So the right end off the value minus one. If you put 22 go up to 90 so we need to go to 20. So we're going to put 41. So we're parading all the range of numbers. No, we need to check whether it is even or not. What is the rule for chicken? More to equal zero than even? You see, we're putting every item into the list but is in for Lou to range over 1 to 21. And if the item is so, the item more two equals zero. So every item in the range of wondered worry if it is, even then it will be considered into the even in the school list. Let's bring even in the score list. So let's run the program in a building. Ha ha. This here crew 468 10 12 14 16. Eating and quality. That's how you use the least comprehension. So if you want to store this rears off these numbers, you see, I'm going to show how do we use square streams or off to the explanation in two. So if you run the program, you see here all of the numbers with disgrace. So this is the easiest way off creating lists. So this is how list comprehension Czar used. Thank you. 43. Functions: So now we're going toe. Learn about functions. You see functions is a very, very critical part off any programming language because this have a lot off poppers on any amputations. So let's learn how the right functions. So what are functions? Functions are block off organized, reusable code that he's used to perform single related action. So organized, reusable court. So organizing teens, the court that we're going to used that we're going to use must be and organized movie, which means it must serve a purpose that second is reusable, which means regarded be able to use a gain. And again and again they never wherever we need it so heightened provides two kinds of functions. The first is pretty defying functions. The next is user defined functions prettify These are building functions in pytorch. So, for example, until this lecture, we have used the building function, which is Prince ST Yeah, Pretty is actually a function. So bring is an example of pre defined function there many and lof pre defined functions in title. The next he's yours user defined. These are the functions that users can create performance user specific past. So these have we have the freedom to write our own functions and those intrinsic all user defined functions so defining functions. So functions begin with the keyword death and followed by the functioning. The can get any name we want, as long as it doesn't collide with the function and followed by a parenthesis. So then we have a functions beanie it to use some variables because, after all, we're using functions to do. Some operations and operations require very bills. So when we have variables and the court that we want, process isn't some function. We need to pass these variables to them and the passing parameters. So these variables are called perimeters and these must be placed within the parents is off the function definition, so they're available for the function to serve the past. The first statement of the function can be optional between a documentation string or common, which is plainly for the use off the developer. The next is the court brought within. Every function starts a call on and isn't engage means similar to how the used in if he fells, why look for low similarly, after the parent this end, we need to put a call on and the block begins and we have toe Indian all lines of court. It belongs to the function. So the statement written expression exits a function passing back an expression if necessary, which means Virgin statement is the end off function. So if you want to pass any reason for the main cool which is using the function, we need to put an expression which were written the value. So we're going to see a demo core. So here it is so defining a functionally visited name and functional. Once it is completed, we can use the function inside another function or directly from the pipeline box. So they have given a name. We have passed the para meters. We've ever done the cool, but we need to call the function to use it. So here's the syntax for defining functions. So the key was death. The name of the hungry, the paramedics inside parent, this is in the colon and in the next line with inundation. This is the documentation stream off. You can also call it is a common. This is for the plane purpose off serving the developer understanding. So the next race treatments. So the statements are those why to process data the last years of Britain, and the expression is optional because green might result and expression all value to the main call or assume do not so the written and their expression is optional. So this is a brief introduction off functions, so let's get to the programming part of the functions. 44. Functions in Practice: Okay, guys know we're going to write functions they haven't asked here. What is it? That's right. A function that region. There isn't golf. He plays. Behold square. So we're going to relating Matt Operation here, which is quite un relatable. But we're doing it for the specific purpose that we can do anything while we can add two numbers. Multiply dynamos divide numbers greater numbers. So but there's no point of writing function for it because we're already having operators. But and bless the holes, Where is something that we can written using the function? So let's just right the function because we need a function called So let's define the function Define What is the name of the function? My under school function If UNC the parent, This is the perimeter that we need to calculate the result off this easy and be so let's put a comma be on the colon So we need toe give a result result is equal to what is the farm law off a place in the whole square? It is yes, we're less the square place two years B. So this is what we're going to write? You're square less be square. So this is not a disease square less to be. So we have the reason. Oh, so now we're going to use them to send to the coal where we're going to college. So now we have the function that can visit. It has no Oscar value. So let's use it and put it in the print statements all that weekend. No, or these going to return. So I'm going to do and the values to come a dream and run the court and the values fortified because two square last risk way less to into into three. Which means that's how it couldn't so not just giving para meters that by hand. But we can also take the user input and send it to them. So I have a goal in also in poor and a and be will be off and your bean and soft comma three people equals B. So let's run the program and see what it presents to 3 25 and let's run the program again. So yeah, and 15 6 25 So this is how functions work. You might as well understand and practice a little bit with kind off meters, and it would be very helpful for you 45. Function Arguments: other guys. They have learned functions and how to write functions in Python. But there is a second concept that we need to learn about function argument. So what often charge meets the pattern? Because that we passed to the function called arguments. So there are different types of arguments quiet arguments, keyword arguments, default arguments and variable Lendl. These are the types of arguments that we have in Fighter said the very 1st 1 ease required arguments. These are the arguments, passage function, incorrect positional order. What is positional? Order? The order in the Chew best had a megastore function, so the order should not be changed. The number of arguments and function call must match exactly with the function definition, which means when we defined a function, be space for the perimeter that we need to pass to the function. When we call a function in the main program, they need to past the same number of arguments, not more, not less. If you see the third point, it states clearly the definition of function has a paramount arrest. You, when it is called, there must be a strong reliable passed to the function, not like the 1000 had a meter, so the second ist keyword arguments. These are related to the function called, but these are using function. Call. It identifies the arguments by the para middle name. So these air loc to skip arguments are place the motor for the previous one. We need to maintain a correct positional order. But in Cuba arguments, the reasons is a known necessity. I maintain that order because we're naming the arguments right in the function cause. So if you see the example, there is a There's a function definition within four baby, a passing name and ages para meters. The blow. The last line, If you see the function, call they specifying the paramedics age equal to 50 and name equals done. So even though name comes before age in the function definition because we're specifying the perimeters as cable, our demands in the function call. There is no problem at all. The next year's default arguments deal argument is human default value if you're not specified in the function called. So it a key were arguments in the position, the the quart arguments that we need to meet in a positional order and the number of arguments just the same. But in the different arguments we have the Freedom toe reduce the number of arguments that we can use in calling function. So when we defined a function in the example, if you see we already specified, Eiji called 50. So if there's a default value, so in the below last too late if you see the first is in for equal to testify and Chemical Mike. So here we're using keyword arguments because both are specified and the auto Open. It will be my commented fight and the last land in four name equal to Philly. Here building. Specify the age when we didn't specify as we have default value s 54 8 In the definition off the function, it will output Philip and 50. So this is how default arguments are used. If you're not risking any value, it is June said Default value In the definition of the function, the last is variable and arguments for these arguments are used. They can taken Albertrani number off. Arguments between the function can take more than one arguments and we do not know how many off then. So in short, off space, fine all the list off arguments. We use an asterisk which is used to define a very small number of arguments. So if you see the example, you have to find a function more that's para meter as to risk X. So then there is a national risk. We can define it as a variable number of arguments. So in the below, we're passing more at five comma string my eight. So this entire 35 my eyes will be inside a single variable x the function. So when it prints eggs, it is opening testify in my age. So this is how available and arguments are used. So the next coming lecture, we're going to see how to use each type of arguments and understand how to use them, depending on the requirements. 46. Required Arguments: Okay, guys, in this picture, we're going to learn about required out. So as we have known that required arguments are, any arguments are used in a function that's defined 100. Our function is going to during the details off person as well as in examples. The leaders are name and age, so we have specially to crime in this name and age. Let's bring them. Bring Nan is name and bring age as each. So that's it. That is the only thing that we're going to do here. So let's take input from the user because one our programs to graduate from here to let's call the program. So when we're calling the function, you see rafts to perimeters, name and age so called function. It requires two parameters. This is the only thing here, and the requirements such kind. If you interchange it with, like a judge common name, it won't work because although it could do 30 days because you can assume any there, right, because Payton ellos not this place for any data, right? It's going to take the values. But when print, the values of the variables are mismatched, so really to maintain current position are positional order, and also we need to give as many arguments as it is persuaded that function definition. So name comma age is a character order, and we cannot live up age our name or give any extra parameters. So that is the case with required arguments. We need to mainly in the order and we need to specify the perimeters, as we have specified in the function definition. So let's on our program and Abdo there's into the name as needs is very hot prince in the village. So are our program goes Kurt. So this is how you use required arguments? 47. Keyword Arguments: honored guests in this trip, we're going to learn keyword arguments. So, like in the previous victor, our function is going to be seen. More arguments are going to be seen, but for but little guides. More arguments for understanding a bit more. So let's side are function. We're going through the evidence or for name comma age. Come on. Yeah, uh, we conclude as first name and last. So this is the thing, These other arguments. What other? What other arguments? First name, agent last, and let's print allegiance plus name and bring last mean and bring edge. So how can we call others? So that's right, our programs. So we need three para meters. First name. We called lights, right under first name. Last name and age is indigent, so I casted. All right, so if it is a record arguments, we would do it as first name. It's, um last. So this is how we would call program if it is required, outgoings. But here we are using key world arguments, which means we have the ability to specify the argument that they're sending it, so we don't have to mean dean and order him. So here we do not have to maintain in order. So let's see. There's I'm going to give last underscoring equal last first under scrutiny required first and it could do it. So if you see how completely changed the order But I have specified sending each parliament with because this will allow the function to know which argument belongs to which value. So this is how you can use keyword the argument. So So let's call her program in a judo. It is 34. You see, when you have used require arguments, it gives first name last name laid by. We have changed the positions when cure arguments extremely leaves the same. So this is how you can use cure arguments who let the future work as it is one. But we have the freedom to change it out of the order. 48. Default Arguments: other guys in this literally organ. My screening. How do you use default arguments? So But, you know, arguments are used in a function. Let's write a function. Now we're going to write a function that can print the details off a person like name and age as you are seeing the examples. The previous lecture. So I'm writing a function in Fort, so the first will be name the next of the age. So what we're going to do, we're going to bring name along with age. All right, that's it. We're going to do nothing else. So let's make a program in tractor by taking input from the user. So now we're calling the function, So here they are. So here there are two arguments. New mandate in the function. But in the case of default arguments, they have the freedom. Do not specifically argument that has been given a default value. So I'm going to do you default value for age as 50 So we're going to do two things here. The first is calling the calling a function the ditch and calling a function without image . So let's call with is as first in the next years without age, we're only going to give name. So let's one off. Programming T low. Yeah, it is asking your name. I'm gonna get Philip. And age is 35. If you see for the first function call. It brings Philip and a justified as their scent is as well. But in the kiss off, Not facing the age, it prints the name as we have sent it and it prints default value of 50 as we have not satisfied our age para middle. So this is how default arguments work. 49. Variable Length Arguments: so in this actually learn about variable and values. So we're going to use the same function off printing the details off big but you differently. We're not going to space. For Harmon, arguments within the past is gettable and arguments. So let's write our function. And, as we have all the share when it is available in, governments weaken dash risk and I've named my readable is X. So when it sees an asterisk, it knows that it is a variable and got cola and print. Exe. So it happened. All the lead is it would bring work X contains. So I have your name and age as digital the age, so I'm going to call it with I mean comma age and let's run a program in a job. Is he after me? Free, like live use or a six? You see, it prints it. So what is the parentis? Is there a structure? It's stuff. So the variable and arguments are in trouble. So do you need a more? So if you want to access indigenous labels, you can also write except directs of. But it is more easier to use a loop. No, let's on our program. She, though silly. And a 46 You see individual items. So if you want as indexing it by, do not know how many arguments has you can write it like this. So I'm going toe observed the length before I know about it. And now I'm going to use the for loop and the range Very book from zero to Lando X. Jeez. So the evil ranged from zero to the length off the couple No re Ken excesses as X a fight. All right. Next on our program in the notebook name is lit his 50 Prince Philip and 50. So this is how it is useful to send, as in agony just want. But we do not know exactly how many were going to send the case off that case of requirement. We're going to use variable and off arguments 50. Scope of Variables: Hello, folks. Now we're going to absurdist program, which will clear our doubts about the school off any very. But so if you understand this program, you may well get clear with the scope of very butts. So here total here there is a total very, but the Commons is this is a global available because it is not defined inside any program . And next we have a function definition with some as its name. It adds to members and invariably zones for torture. But this total is a local variable. So we have a global variable in total and the local variable name total. So here we're printing the value off total. So here is the input. We take two numbers as input and recall the function. And finally we're going toe bring the value off the global variable which is outside the function and observe that thes board have different access or not. So let's run the program and the first name, but I'm going to add. Then on the second number is site. You see the opera tes inside a function total equal to 15. But outside the function talking equals zero. We mean that after calling the function. The sun function is going to add these two members and assigned the value to talk to, and it will prove the value. But when it finishes its execution and it returns it control to the main program, the access to the total lot available is lost and the value off the global variable Cordless printed. So this is how the scope of available works. Thank you, other guys. Until now, we have used variables in many ways. You have past evidence to functions Pata Meters and we have understood how to use para meters depending on a requirement and have reviews vegetables extensively and almost every program requests to use a very big so very well have a special property called school and let's understand the school off vehicles. So So let's understand what it's cooled off. All variables may not be accessible at all locations in the program. The accessibility depends on where you have declared a variable and he scored school for. But these two points it is clear that we cannot access all the variables at all locations, all locations and at all points in a program like way cannot access available at every part of the program and the accessibility is called scope of Very so. There's basically two types off scopes for variables, global variables and local very well defined inside a function body. Have a local school. Those defined outside have a global, which means we have understood that rewrite functions and programs and functions of the extensive liver. So the function variables means variables which are defined inside a function are not accessible outside of it, so we can play the variable inside of function as long as we can. But once we have come out of the function, we cannot refer to the variable anymore and variables defined outside of the function. We can use it at any point of the program, so this means local leaders cannot be accessed can be accessed only inside the functions. Usually declared global variables can be accessed from anyway through the program. So this is basically all about scoop off. Very. But so let's try the program to understand what actually means and how we need to write a program. It doesn't make any mistake off access and very 51. Program on Scope: Hello, folks. Now we're going to Joe This program which we clear our doubts about the school off any available. So if you understand this program, you may will get here in the scope of neighbors. So here total here there is a total very. But the current says this is a global with because it is not defined inside any program. And next you have a function definition with some as it's me. It adds to members, and it variable is also total. But this portal is a local variable, so we have a global variable in total and the local variable name total. So here we're printing the value off Kota. So here is the include take two numbers as include and we call the function. And finally we're goingto bring the value off the global variable which is outside the function, and observe whether these boards have different access on North. So let's run the program. And if listening by my dad, then on the second number is flight, you see the opposite is inside a function total equal to 15. But outside the function call click Wazir. You mean that after calling the function the sun function is going to add these two numbers and assigned a value to go to and it will prove the value. But then it finishes its execution and it Retton's it concluded to the main program the access to the total local readable is lost and the value off the global variable Cordless printed. So this is how the scope of available works. Thank you. 52. Files: August. Now, under Novell Ridin programs that can do calculation, it can work with data structures. It can be evident functions, but now you're going to use fights. Yes, fines that Iran your system. So let's learn how to write them. So the very first is open. So the need to open a file like how we do and traditionally when we need to view the files or two, uh, right contents into the final meaning toe, open it in similar fashion. We need toe open the file problematically, too, So fight on provides basic functions that are necessary to manipulate files by default. You can do this a lot by using a file object, so the basic point he's fightin provides a file object, which we can use to manifest. So dysfunction will create a file object, the object that is necessary to manipulate fights. Now the syntax is here, whooping the name of the sign that we want to open and the access more and the buffalo, which means which will allow toe right, convince off re contents and then by using a buffalo. What about the access more? You're going to this you can do it. The para meters finally acts more. You see the access more read, write independent the buffering it is set to zero. No buffing will take place This settled one lying about things. Therefore which means lying will be read And another lane is really in the buffer toe to really fast. So here are the fighting Words are it means really we cannot do anything else but really condensed from the fire and the artist which means it opens the fire for both of reading and writing hundreds to the fight w it is right. Only another special cooperation is dead is the file name the specified doesn't exist. It will create a new file with this name and w Place is for opening file for both read and write and another futures creates the fire but doesn't exist and that the lasted more this year. This is used for a pending to the fight, which means it will happen. The contest that we have to the already convince present inside the fight does it is the operation off creating the file if it doesn't exist and the next is filed off. The adults therefore attributes for our file out the first is closed, it is written in True. If the file is closed, if it is not closed with Willard and Force and the more off the sign, which means read, write and these kind of more. And the authorities name written the name off the file that we that we are having excess food the last year. Soft this it will written false. If the space is explicitly required with paint, it's not helping the next year's close method. This is very, very important because whatever files that we opened problematically it is really important that we closed. So this method flashes any underdone information and closes file object after writing cannot be done and fight on automatically cruises a file. But the reference object of file is resigned to another fight between it's the The object that we're using created by the open function is referred to some of the file previous file will be closed automatically. This in taxes while object that close the next is reading and writing to files. This is the ultimate operation that we need to do because then the access a file we either want real contents from it. Are we wanna write contents do it, so the attitudes are read and write. You see the very, very simple because, as we have three, as we have known in the first lecture itself, that Eitan is really close to the language English. So it is really easy to write programs. The right function is used to write any string to open fire. This is the syntax file object, Doc, right? The string that we need to write to the fight the next he's read it, read system from an open file and sin taxes file Object Gottfried and the convertible it is optional on the cone is used to sweets for the number off bites to be read from an open fire. So this is how we're going to do manipulation operations on files and then the next lecture via going to actually manically finds by using these functions. So let's get ahead 53. Write & Append to File: Okay, guys. Now they're going right. Program the Demonstrates Hogle, right? Convinced to a fight. Okay, now I'm going to create a new file. So I'm going to save this as flying start by que? Yes. So the past quarter program is opening a fight and then writing, contented and then close. Divide that. So I'm going to give you to ask 51 equals open the fine. Let's get in into the fight I write. Does you filed dot Txt comma. We're going to write it so right more. What if the fighting doesn't exist? So what'd create if I w place? So this is how you create a final, right? If it doesn't exhibit, we create the fire. So now let me check the final more. Then what? What I'm gonna do is I'm going to write content, so I'm going to write a few a few lines off content. Sanguine, riding. Fine. Job 10. What is the method? It right? Right. Method by one door, right. This is line. I'm going toe number here. But one thing we need to understand this, right? Mother takes on the strengths not into just in this case, I easing into So what I do? I cast you to string. So why Why did you write? Bless one? Because I start zero to lie. So Strothman zero last one. They get what? So that's it. I'm going to put a new line here so that the lines does not merge between them. And the final thing is to bruise the fire, find one waas next on the program and observe you. Yeah, if you see here. If I was created in the right more so, Yeah, we have a program. But where is the fire? So you need to go to the directory, which, despite on program is saying or else opened this explorer. And if you see here, I school? No. And here it is the new filer Txt that you have written. Blues Exporter. If you see the Everton lines one through 10 here on. Right. So this is have your right to fight. But what if you want a pin something to the fire? Who lets right program That happens data to the fire. So I'm going to create a file object The name of the finally seen Julie Less. Now again, I'm going to dreams and more So here I'll just write one thing flying to and the same letter, right? But the different water to make is the man in the rich more. We have opened it. I am a pending dead, uh, who is five. All right. And finally used If I all right, if you run the program, you see, first it open in the right more. And then in the pending war, let's open the file and see. You see, I am a pending better to this fire. So in this way, we can write better to file append data to fire. So it makes a clear point that we can easily manipulate the data that isn't fires. 54. Read from Files: Okay, guys, No. We have learned how to write better independent into the fire. Let's learn how to read the after the fire from the fire. So very best thing is opening a fire. This is a common in every case. So I'm going to give you five objects. Well, Ben, you find dot txt in the morning. The trouble open is a read. So the final isn't read more so Know what we do? We read the condensed some off and read will do the condemned in a string form. So we need to store the country. I will give variable content on the method Ease Find our raid. So that's it. The fine entire file letter is in condemning. So I would bring the content the final ease to close the fire That that Centobie write a program to reconvene from a fire. So let's execute the program. You see, then tired data isn't right here. So there is a different day how we can read the data. How so? If you find this too big, too enormous to read in this way we can read individual file. So how do we do that? So lines equal. Find or there is a matter. Read lines. What does your creeds line by line. So now we need to buried with each line and lives. So now I will print each line and the clothes the fight. So let's run the program. If you observe here now, we ever know reading better line by line. So this is how you read data from a fire and abjure the Opens? Thank you. 55. Exceptions: well, good guys. Now we're entering into an important concept called exception. Handling isn't even that occurs during the execution of a program that disrupts the normal , for what do we mean by that is a point on program is exempt execute er a sequential floor. But if anything happens, like some even occurrence can be said this normal view of execution, you can read the program this golden exception. An exception is a Piper object at present another, which means something wrong that has happened within our Python program. It's called an exception. When an exception is raised, the script must handle it. Others ways it terminates and quits, which means the state more obviously, then says that we can handle exceptions. Any kind of exceptions can be handled, but we need to white a fight on script in such a way I can handle it gracefully. If not, program will terminate and quick. So how do you handle this? Exceptions? There is any block off court, very suspicious to call any exception, please, the block off court inside the place to play X statement. So how do you write? Single price statement can have multiple except statements which means a single block off coal can result in having multiple exceptions so you can provide jerk except clause, which handles any exception. So instead of specifying multiple exception, you can also generalize distinct and make it happen any exception you want so after that, because you could include an else cross between. If the problem doesn't please an exception and else block cold gets executed. Which means if the try block core has is supposed to raise an exception. But if it doesn't, there is an else block, which gets executed. So this is how you're white. An exception. These are your right try except love without any exceptions. This kind of cracks in blood cancers all exceptions. This is not a good practice, because talents the exception, but it doesn't let the programmer identify by. The exception has occurred the next, actually, except with multiple exceptions. So if you see here after the exception, except he were, there is a parenthesis, and there are some perimeters included. These are the exception variable. So if there is a next, any exception occurred from this from this list. The exception gets catch and finally straight. Finally cross the finally block the executor weather Nordex section is west, which means it's even if the exceptions occurred. Are you lift? The exception doesn't occur. The court and said the finally block we get executed and this block must contain, like closing a file of resource and any network related. Because finally, look has to get executed. Argument off exit. So an exception can have an argument but provides additional evidence about the problem occurred between. We understand that exceptions are cause and the program is able died in for the exhibition . By that today, you accept, followed by the exception variables, but also we need to have an additional the information about that section. So this is where the argument comes in handy. This variable receives the value of the exception mostly containing the cause. Often exception. So the exception type is like telling us what type of exception has occurred when the argument variable can says the cause off. The tech ships exception, so raising exception so it not just handling them. They can also raise exceptions depending on our need. So hopefully raises exceptions. The sin taxes raise, followed by that exception that we want to raise, and the perimeters so exception is the type of exception. Ours is a value for the exceptional in. Previously we have seen in the garret structure couple that when we tried toe ad elements stood out. Remove elements from it. It raises error that are mostly Zachary occurred in our programs, so raising an exception handling an exception must be a important element off the programming skits, so let's learn how to handle them and raise them. 56. Handling Exceptions: OK, guys, Now we're going to write a program that is going to handle exceptions. So here were taken inputs off two members from the user dividing them and printing. There isn't So let's from the program freakin asking first member and will give us too in the next school use. It is a fight point. All right, so it is working Well, right? So let's run the program again. You see? Now I'm going to give the number eight. But now I'm going to give it to number zero. And if you see dosing by zero So zero division error is occurring here. So we need toe handle this ever because reading space Father used not gives you for B so we need to have it hold Randy. So I have already said that if there is any block off cold that is suspect ful off causing another, you can handle it by using a trails block dry except else block. So the first line doesn't cause a near the second leg doesn't cause any error because these are taking input. But when it is causing the error is because of illusion. So we need to put this block off court Inside Trade book. So right, Fred, Doc. And no, except Block, and I'm here printing. If there is an exceptionally suckering, it is all because can divide by zero, right? And now the else block it's no exception is occurring. Then here we need to come. All right, let's one. The programming. Absurd. Ill. So then zero. If you just telling, can divide by zero. It is a much better way of handling exceptions rather than the previous one, because the previous time it is telling zero days in a row and it's and in the program. But here we're handling so now, meaning we have the ability to handle the handle it. So letter on the program and again and see how to get into the else block. So then and to you see, it is printing the result, and because no exception has occurred, it's getting to the else block, All right, this is how try, except in Dell's works. So here we can also specify what a what type of exceptions should be handed, so he had really in space vanity. But we can also specify so that a few list off exceptions must be handed. So like I read pretty Kara So he have as pursuing that giving the Red Medical er actress would then handle let section. So let's run the program and observed a goat. Then one INGE Eagle. Yeah, it is handling it. If anything else occurs, it's not going to hand because we have specified that handle only read medical. So now here we're introducing the finally block, which comes in the Final Four. So here we're writing. Did Gordon always gonna do it in the program? Because if the cry block gives any error, it is handled over exit. The clay block doesn't vigneron in. The else block is executed, the tribe log if if it occurs another or if it doesn't occur in a nearer. In any case, the finally block we get executed. So let's see the program. So if there is again and to you see it is printing five point, though, and it tells high else because no error has occurred and it also certain that I always get executed in the program because it is the final bill. And if you will run again now, I want you 10 and see if you see now it tells us, can divide buys you. The except Block is handled because there is an exception that is occurred because of zero , and then there is no else block. And then the finally Blawg gets executed. Both of the cases the finally block is experience. This is a reason why finally, blob is very useful critical parts of the program. So with this reef initial exception handling the next picture, we're going to see hope to raise an exception. 57. Raising Exceptions: hi guys. Now we're going to learn how to raise exceptions. So let's is room that are developing an application you need to pay the user data. And while taking the user data, there's an inch better. You do one minor people to register for the education, so use with five at the age of the individual is getting registered to replication has been more than 80. Oh, quickly, but not last unity. So you need to write code to check whether the candidate is actually music or not. So let's right. For example, you are taking the input off. For example, you're taking the input from the user like and age No, he has entered age, so it's age is less than 80. You can tell him more value age and here that stuff that vacation cool might exist. We don't know what the court let's forget about it. But here we need to handle exception, insanitary that if the age is less donating, the program should not go below. So how do you so Yusof trending it? Let's put this block off court inside the trade block and now raise value. You can reason here, but I'm here raising value it. So what do we know? Do not handle it in except block. Bring age nor valued as look green Value age Continue. So what is happening here? The trying long has an error. It gets to the except laws and it breaks if there is no error gets to the elder Law and it is very rage country. So this is the type of hanging that we need such kind of cases. So let's on the program. So if I say 50 it is valued age. Continue on the run the program again. And I give a 16 which is age, not value. So this is the way we raise the exception using the keyword raised quarter by any exception , So thank you. 58. Iterators: Okay, guys, how we're learning about energy. What a reticent fight on a vital die you can use with the foreign. Remember, For you can use it with the type of data and fightem. Then it is calling it Heard? I don't wished sex, apples, dictionaries, all examples off traders. These are the English it reads that had provided by the fight on language. It's that we can use a foreign. Any object that wants to be an innovator must implement these methods. What other business underscored under school, eager underscoring the school This matter is called initialization off any dream. And next month this mother wouldn't say. In actuality for digital, when interpreter is used in the look it replaces Klay caused dismounted practice in which side so basically what it means to use the for you. That next function is being called every time. The value is a greater for the returning variable. This is up to the TV critical part. But I understand how could creating it reading You need to have some object oriented concepts about python which were handling in another course. So right now, with this course understanding that it would do is a type of object they can use it for in and we can clear the trigger losing eater. And next functions I will list. Set couple actually is other examples off in bill generators. So so that this picture is what we're going toe. 59. Generators: So, guys, here's a new concept. Generators. This is a completely different concept related on functions, so this is very, very quite useful when they're performing some computational operations. So let's learn how to write generators and what other generators on bite on a similar to functions. But one distinguishing characteristic is a year statement. From this, it is clear the generators similar dysfunctions, but they used you. The generator is a functionally Children's of generative object. They're in pipe on almost everything is an object, a number stream list, said couple dictionary. Even a function even a function is a fight on object. Even here, generator repented, generator object so this generator object produce a sequence of prisons. It should have a single object whiling functions. We have the statement Britain, which returns a simple single object. But in the case of generator, it rodents a sequence off objects so the values and so they can be treated are created by the statement. So when you say a sequence off fizzles, that means a written statement cannot be used because because Viggen results in a single object, so instead off Britain, we use your statement written multiple sequence off objects. What is the scene index similar to the case? Off written, Be instant, often using. So they never took the yes hitman it's executed. Then type program execution is stopped and the value behind the U statement better and the execution off generative is interrupted now, so as soon as the next is called again on a generator object the functional regime execution right after they you sitting in the court with the last college it'd, which means when you shipment is occurred digs getting stops, it returns the value behind the generator and then venue to call this next function between have already discussed in iterated. It's this conscious car. The execution which has been stopped and delis called will be resumed and the real and the execution happens. So this is our affiliate there. The general function says the state of our local village is white because the execution stormed after calling. Next execution is resumed because between the stopped and resumed all the state off, the function must be saved, so the key difference between function and generator is the functions. Finish after Vernon statement, while Jim read a sea of the state after every year statement and continue their execution with each called next. Here's an example. Here is this generator function with name City instead offered, and we use in because it is a generator function. You want you to you and below X equal. The cities were calling the generator function, which in turn creates a generator. Object remembers. The generator function will create a generator object here. X is the generator objects while the bill open shipments. The 1st 1 extort. Next here, the first deal value will Britain, which is one here. The execution stops, the value is printed and again, the execution at the second, next his resume. When it returns to the simple way the tour, the jeans resulting in this way, the generator function results in sequence of values insured a single well. So let's right a program which can demonstrate how to use generators. The next lecture 60. Generators in Practice: Okay, guys. Now we're goingto create a generator and see how African music before, they had literally simple function. Yes, Simple. If you have ever returning one. All right is the Drink it and let's run the program. Yeah, you tridents one. That's clear. If we want Overton multiple values, we cannot put one coming to a country like that. Nor can we create returned to. Because that happens. One is rhythm. Okay, V right. Invent another function. Even one rebuild in two times because the function control never reaches the second. Reckon shipment. So how do we get that? How can we get multiple sequence off values? The answer is generators. So we need to use in statements. Generators use you statements. So we start off rhythm right? Yield one well to he three. All right. And now being Wait a minute. Already been seen that general functions create generator objects. We need to call next on the generator object. So let's create a generator. Object like generous Could object equal. Do simple. Now that is a generator object. Now we can call next on the foreign object. Since we have three. Your statement. Let's put three calls to the next truncheon. And now let's execute the program. You see, we are getting three results, so this is really is helpful. So what happened? How can we say that the values between each next call have been save in the function so issued off? Simply writing dysfunction. Let's return food. Bernacchi members. What off, Fibonacci numbers. So fibrinogen members are from wine. One, 35 ain't. And so how do you get this? Secrets very shot something. So the first is zero and the next one. And from here, the previous two values get added. So zero plus 111 place 1 to 1 place to three to plus 3 +53 plus +58 and fight place eight. What is the next value? It's studying and tour because this is the court for generating for Benecke Nimbus using you. So if you observed a function here, this is a generator function because it is yours in e, we have initialized they envy with the first initial value zero in one and see will be holding the values to get the secrets. So we have created an infinite loop, Delia, because this will militant in the sequence values to the general object, so we had also created a concrete. But why? Because the count credible Wilder to mind how maney numbers in the sequence must be generated. So he does a generator object f so veto rate through the generator object using the for loop and we print each well and the count will be abated. When the cone gets to 10 it will be break. So we didn't call here got next function like in the previous example. But how does this function? Very because we have already seen in the care of the part of this picture is that the foreign loop called the next function right executes. So we don't do the foreign tribunal to call next function explicit you. So this is the generator function. So let's see whether these ABC values are holding the states will yield function. Gen returns and go resumes to the function. So let's run the program. Yeah, here it is. Here it is. The sequence off American members. So with this, it is created generator functions when used yield. This day, they say the state of dysfunction variables 61. Introduction to Decorators: alright guys. Trivia going to learn very new concept on decorators, so decorators, a Lincoln and related functions. But before we learned decorators, we need to get a good understanding or functions and how to use them. So functions are nothing but similar to objects, So every data type in every beautiful and python is an object like the number that arrived string list said depictions. Everything or objects, even functions are fightin objects to. So let me prove it by writing a function and utilizing it. Invade we did for fight on objects, so hair defined function, death. This is function if all right, so we have defined a function. I'm saying that fight on functions are objects to so hopefully can identify function by its name F. So I'm going to give it another name for equal F. So I'm going to call it F and Funk as, but so this will make sure this statement is actually valued or not. So let's run the program. You see both of the statements bring the same thing so distant this education. It's proven that fight on functions are objects as well. You can Lincoln. Similarly, I spite on objects so we can use the board names for function. In fact, I can actually did it f and still use the function. So that's on the program. You see the first to offer Ephron funk in the next years for funk. If I tried, toe call s Now you see there is another name because we have dilated the f so the this it is understood that quite own functions are objects as well. And if you can create functions inside functions like national functions similar call nested list a list inside a list. You can also write functions inside functions. Let me Right. So now we are defining functions inside functions. For I have a function f which has functioned jeans. I'd so it will be like friend. I am G Thanks for calling me. All right. Here I am F I am calling G. Now you see You see cave alums of the program This is the function f This entire thing is functioning. The only thing different from what I have done until now is we have created a function g inside f. So this part here is different In another function. This party is a different function, but it is a function inside the function f and these two lines belonged to function f. And here we're calling the function G. So let's see, what is the open? Yeah, I am s I am calling Gino. I am G. Thanks for calling me. So let's understand execution first when? Because the function is defined And when we call f it is going to get here and it will be the function g will be defined but nothing happens because we haven't called g it. We have only called f So this line will be execute er so the I m f who will be printed And now the next line I am calling Gino will be printed and now here you will call G. So it comes here and it prints these board lines. This is a fine low. So I hope you have understood how to write functions inside a function. We can nest as many functions as we want. Previous example the previous example might look like a nonsense because there is not much you've with it, but what we're going to do now we create I'm a huge difference because everything in python are related. All this even function para meters are leading good to objects. So, as we have said, functions are next to we can pass functions as a paramedic to another function for let's right functions as batter meters. So right now I'm good, right? A function death g I'm going to call it. I am G. Thanks for calling me. All right now I'm going to write F, but this year will have sunk available. So thing green, I am calling G No. And here we're going to call Funk. But what is the difference is insure off putting D Day. We're going to pass the function G as a pyramid. So let's one the program and observador, huh? It's works where, like the previous one. So let's understand the pub. We have defined the functions F and G. So she has two lines. I am Dean. Thanks for calling me now. Well, the Function F has available funk, which has to lunch to print and the final line, which is a calling off function. So when repairs F off G, their function is called GS variable As a pattern meter, it is referring to funk. So here funk he's referring to the function g. All right, so fun is refering to G, So these two calls in there get executed. It is similar to calling g. All right. This is how functions are useful to send us perimeters toe another function. So we have seen functions as paramedics. So there is another feature that we want to know. What? So let's recap what we have. So the first thing is functions our fight on objects to all right. And the next thing is, functions can be nested. Thirties functions can be sent as para meters. The next thing that they're going to learn now is functions can ridden functions. All right, let's learning. So guys weaken ridden functions from from a function as well. So let's write programs. So I'm going to have function f here, which has available X and returns function G. So I'm going to add this Y and X and someone of the number two and I'm going to written this well. And now I'm going to written G. All right, so let's call this functional inside underscored equals f off one and now breed cider and score off, too. So let's understand this program So G function returns this value batting the variables and Africans G So how does X is accessible here? Because this is a function inside a function. So this is a local variable as well. So these variables accessible so X is accessible inside G But why is not accessible altered off parts off a g. So here it is inside, under school f takes G because F returns g and here it is similar do g off to All right. So let's run the program and Obdulio you see yeah, you to identify one place to place to this five. So this is how functions can be written as Param it functions can return functions. So these are the because of that we need to learn before writing decorators who understand the functions are fight on objects to functions can be Nestor functions can be sent as parameters and functions can return functions these air because then because functions our fight on objects that is the basis off all these functionality that has that has been done . So let's get into the next lecture which is the baby of actually going to write a decorator 62. Writing Decorators: you guys It all our understanding about functions. The previous lecture. Let's observe this program. We have a function as a decorator. Here it is decorated the functional school rapper, which calls a variable with funk inside it. So out of school, that rate of return to function and our underscore decorator has a perimeter, another function which is called inside dysfunction. So the function that we're using here is full full effects. So before we decorate dysfunction, we're calling it with high. All right, so after we declare here, we're decorating function. So here, actually who refers to function underscore rapper. All right. And here we're calling from national school Rapper of 42 and disinter you call Funk the Cheese Food Here Funk Resistance Group. All right, so let's run the program in a judo. You see, we called true before decoration for high net returns Dysfunction High food has been called with a sheriff export high. So he had be no decorate Fu Vitesse. What is full function on the school? Rapper is a so here we call dysfunction before calling here food. What is the funk? Here is the funk dark name the function Repairs to his school and we have called from Cough X. Hi fool has been called with 42 we're after calling from dot name and written in the function. This is the end we call food after decoration 4 40 So this is how the decoration works. You see, if you keep up the after the creating food we have called for 40 group what it does goes and prints the vet from there from the functional school rapper inside the function of the school rapper here. What food frustrate the 42 really called from here it will execute dislike. So with our understanding in the pre assiduous, you have to careful up to this program. You have everything in your asset to write to decorate, but actually this step nor proper way to write a regular. The python has a simple scene tax The Children, It's all this complex thing. So what is actually the python equate right, A decorated. So here we're decorating the function. So there was a distinct accelerator toe created a greater So let's eliminate this type of. So now we're actually decorating so underrated. Our underscored decorator really wasn't dysfunction to decorate a function, right. So we put dysfunction here at our own, scored a great this will make through decorated with functional score wrap. All right, so the very important thing is Rimi to write this line just abou the function you're decorating. All right, so this line must be right. Just about, like, deaf fool effects. We have written just about so in the similar way we need to write. So let's run the program. Ha ha. You get the same result. This is the right way off writing a decorator. So with this, we conclude our decorators class.